[Tutor] Magic numbers

Alan Gauld learn2program at gmail.com
Thu Aug 5 11:59:07 EDT 2021


On 05/08/2021 16:11, Dennis Lee Bieber wrote:
> On Thu, 5 Aug 2021 17:48:02 +1000, Phil <phillor9 at gmail.com> declaimed the
> following:
>
>> 128 is bit 7, in this example, of an 8 bit number.
> 	But what is /significant/ about bit-7 (and are you counting bits
> starting from 0, or from 1. It matters for documentation since when
> counting from 0, bit-7 is the /eighth/ bit in the byte).

And this is exactly why bit-shifting is a fault-prone technique only to
be used in extremis!

:-)


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list