delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/13/13:41:36

Date: Thu, 13 Mar 1997 13:23:34 -0500 (EST)
From: "art s. kagel IFMX x2697" <kagel AT dg1 DOT bloomberg DOT com>
To: Dave Smith <nizea AT es DOT co DOT nz>
Cc: djgpp AT delorie DOT com
Subject: Re: Simple Question
In-Reply-To: <5g8poh$q7u@Chaos.es.co.nz>
Message-Id: <Pine.D-G.3.91.970313131842.13611D-100000@dg1>
Mime-Version: 1.0

I assume that you need to know the value of the high nibble of a byte.  Try:

a = 0x1234;
b = a >> 4 & 0xFF;   /* The '& 0xFF' is to mask any sign extension which is
                       not necessary if a is type 'unsigned char' but is if
                       a is type char since char is signed by default. */

Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

On 13 Mar 1997, Dave Smith wrote:

> Heya peoples,
> 
> I have a simple question (I hope) for some of you out there :)
> How in C (esp. GCC) do I find the high order of a byte, in Turbo
> pascal I would do this... a := Hi($1234) which would return ($12),
> how can I do this in DJGPP?
> 
> Thanks heaps
>    Dave
> 
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019