June 16, 2004

Sign extension bit hacks

I received an email from a Sean A. Irvine in New Zealand earlier this week.  He was reading my bithacks page and suggested that I mention sign extending.  I guess he uses Java, which doesn't have the bit fields feature that C has.  I wrote three entries for sign extending, depending on if you have the bit fields of C and a fixed bit width or want something standard for variable bit widths or want something quick and dirty again for variable bit widths.

Posted by seander at June 16, 2004 11:35 AM
Comments