And the (p - n) is the one behaving as I would expect. What am I missing here? Am I not understanding K+R properly in their example? I couldn't imagine that this is a typo.
Any insights to clear my confusion would be greatly appreciated.
--maq
Title:
Post by: Lutz on October 03, 2006, 05:31:52 PM
I guess this is a offset 0 versus offset 1 confusion:
The 'C' language normally works with 0 offset so I believe the K&R text is correct starting at the 6th bit, which is at offset 5, thats why they are adding 1, because they have to shift out 6 bits in total. So 3 is the correct result with shifting (>> bfield (- (+ pos 1) n)) .