tag:blogger.com,1999:blog-7773532993303488759.post7243269575478219121..comments2023-04-12T08:33:48.690+02:00Comments on Icare3D Blog: Bit hacks and low level algorithmsCyril Crassinhttp://www.blogger.com/profile/16474299434636795969noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-7773532993303488759.post-15732461873743761692010-06-10T12:40:26.077+02:002010-06-10T12:40:26.077+02:00Hey, Thanks you for this nice trick !Hey, Thanks you for this nice trick !Cyril Crassinhttps://www.blogger.com/profile/16474299434636795969noreply@blogger.comtag:blogger.com,1999:blog-7773532993303488759.post-49446893175949599042010-06-10T07:59:28.849+02:002010-06-10T07:59:28.849+02:00There are a few more tricks that I never found on ...There are a few more tricks that I never found on those pages.<br />I even sent a mail to the owner of the Bit Twiddling Hack but got no response.<br /><br />Anyway, here is one trick I really enjoy :<br />To normalize a number of n-bit range to m-bit range (with m > n)<br />-> Copy the MSBs to the missing LSBs.<br /><br />Mathematically it is the same as doing :<br />(Value * (2^m)-1)/((2^n)-1)<br /><br />So conversion from 5 bit to 8 bit or 16 bit is very easy and correct. Very usefull for signal processing and image processing.<br /><br />Ex. <br />ABCD.E (5 bit) -> ABCD.EABC (8 bit) / ABCD.EABC.DEAB.CDEA (16 bit)<br /><br />Enjoy.<br /><br />PS : Please do not hesitate to contact me if you want to discuss the subject.Laxer3Ahttps://www.blogger.com/profile/08169499566729515270noreply@blogger.comtag:blogger.com,1999:blog-7773532993303488759.post-5523247350787185852010-05-02T13:54:28.685+02:002010-05-02T13:54:28.685+02:00That's a great post! I knew only the first lin...That's a great post! I knew only the first link.Adam Sawickihttps://www.blogger.com/profile/18016986012138243434noreply@blogger.comtag:blogger.com,1999:blog-7773532993303488759.post-58602330816101043472010-05-01T15:01:41.130+02:002010-05-01T15:01:41.130+02:00Thanks for the reference, I did not know it !Thanks for the reference, I did not know it !Cyril Crassinhttps://www.blogger.com/profile/16474299434636795969noreply@blogger.comtag:blogger.com,1999:blog-7773532993303488759.post-77145567900911057112010-04-30T10:46:59.842+02:002010-04-30T10:46:59.842+02:00Hi,
you can try (if you dont already) the well-kno...Hi,<br />you can try (if you dont already) the well-known book "Hackers Delight": http://www.hackersdelight.org/<br /><br />It has tons of hacks for bit manipulation.<br /><br />Regards,<br />Ruben Penalva<br />http://www.rpenalva.comRuben Penalvahttps://www.blogger.com/profile/02155610208151745748noreply@blogger.com