Path: chuka.playstation.co.uk!news From: "Alex Herbert" Newsgroups: scee.yaroze.freetalk.english Subject: Re: The Passmore Tutorial Date: Thu, 29 Jul 1999 00:19:34 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 31 Message-ID: <7no2dr$oub20@chuka.playstation.co.uk> References: <379CE1FC.D1528C7C@which.net> <7njp7i$i4m33@chuka.playstation.co.uk> <7nl2q3$oub1@chuka.playstation.co.uk> NNTP-Posting-Host: 212.56.113.103 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Hi Scott, Scott Ward wrote in message news:7nl2q3$oub1@chuka.playstation.co.uk... > > Also, why are hex numbers shown as 0x01, 0x04, 0x09, etc. instead of just > 0x1, 0x4, 0x9 and for that matter, why use hex at all? > Wouldn't ((tim1.pmode>>3) & 1) be the same as ((tim1.pmode>>3) & 0x01)? > > Cheers, > > Scott Ward > The reason for hex is that it's binary friendly. Each hex digit represents 4-bits, so it often more convenient when you're thinking in binary. It also shows that the programmer was thinking binary (logic) instead of decimal (numerical), and can make code easier to understand. In the original post, the & operator was used with a hex value. This make's sense as & is a binary operator. & (AND) is useful for clearing selective bits to 0. | (OR), on the other hand, is useful for setting selective bits to 1. Hex numbers are usually expressed as pairs of digits as each pair makes a byte. Herbs