![]() |
|
Tutorial Bit masking and shifts - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: C, C++, & Obj-C (https://sinister.ly/Forum-C-C-Obj-C) +--- Thread: Tutorial Bit masking and shifts (/Thread-Tutorial-Bit-masking-and-shifts) |
RE: Bit masking and shifts - dotcppfile - 09-04-2015 (09-04-2015, 01:14 AM)0xDEAD10CC Wrote: The other trick I use bitshifts for is to efficiently round down to a certain value. Most compilers will use similar tricks in the background if you don't keep your stack properly aligned to optimize for performance between your local variable allocation's through manipulations to the stack pointer directly and any push instructions... But here's an example: This is kind of smart and neat, I like it, thanks for sharing mate. RE: Bit masking and shifts - Coca. - 09-10-2015 Thank-you for this tutorial. Although I already knew about bit shifting, I never knew about anything else you stated here. Hopefully I have use for this new knowledge in the future. |