comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Johnson <mark_h_johnson@raytheon.com>
Subject: Re: Hi byte and Lo Byte Question
Date: Thu, 23 Aug 2001 09:13:58 -0500
Date: 2001-08-23T09:13:58-05:00	[thread overview]
Message-ID: <3B850FA6.21711F4@raytheon.com> (raw)
In-Reply-To: 3B844CE7.B6C85990@san.rr.com

Darren New wrote:

> > #define LOBYTE(Value) (Value&0xff)
> > #define HIBYTE(Value) (Value >>8)
>
> Why not (value % 256) and (value / 256)? Or the Ada equivalent?
>

They work, along with several others. I picked the ones w/ mask & shifts
because older compilers tend to generate good code for them [the
examples you provide require the compiler to detect division by a power
of two and convert...].

[OT] As a side note, there was a pretty interesting discussion on the
Linux kernel mailing list about min & max & the new "incompatible"
version that requires the data type to do the comparison. Apparently
this came from the discovery of several independent definitions of the
min & max functions [sigh]. NIH lives on.
  --Mark





  reply	other threads:[~2001-08-23 14:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-22 14:48 Hi byte and Lo Byte Question mop
2001-08-22 15:56 ` Larry Kilgallen
2001-08-22 16:21 ` Ted Dennison
2001-08-22 23:11 ` Mark Johnson
2001-08-23  0:23   ` Darren New
2001-08-23 14:13     ` Mark Johnson [this message]
2001-08-23 17:15       ` Darren New
2001-08-24  0:00       ` Robert Dewar
2001-08-24  7:52         ` Martin Dowie
2001-08-23 14:43   ` Marin David Condic
2001-08-24  8:09     ` Peter Dulimov
2001-08-24 16:20       ` Warren W. Gay VE3WWG
2001-08-24 17:05         ` Marin David Condic
2001-08-24 17:46           ` Warren W. Gay VE3WWG
2001-08-25  7:15             ` Simon Wright
2001-08-27 16:33               ` Warren W. Gay VE3WWG
2001-08-23  1:26 ` DuckE
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox