delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/13/12:17:20

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199703131703.AA241162634@typhoon.rose.hp.com>
Subject: Re: Simple Question
To: nizea AT es DOT co DOT nz (Dave Smith)
Date: Thu, 13 Mar 1997 9:03:54 PST
Cc: djgpp AT delorie DOT com
In-Reply-To: <5g8poh$q7u@Chaos.es.co.nz>; from "Dave Smith" at Mar 13, 97 11:51 am

Dave - 

You can get access to any portion of an integer type by using
combinations of bit shifts and bit masks.

for upper nibble of byte use 

byte >> 4

for lower nibble of byte use 

byte & 0xF0

for 3rd nibble of a word use

(word >> 8) & 0xF0

and so on

Andrew

> 
> 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