Mail Archives: djgpp/1997/11/15/12:46:14
csantill wrote:
>
> from: csantill AT lausd DOT k12 DOT ca DOT us
>
> Is it possible to do bit testing on the DJGPP data type "long long"?
> It doesn't seem to work the standard way of bits like this(this is for
> longs):
<snip>
type:
info gcc index "long long"
press enter.
try out:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
unsigned long long int v1, v2;
/* check if the 48th bit is set */
static const unsigned long long int f = 0x0000800000000000ULL;
srand(time(NULL));
v1 = rand();
v2 = rand();
v1 = v1 + (v2 << 32);
printf("%16.16llX\tFlag:%s\n", v1, (v1 & f) > 0 ? "SET" : "RESET");
return 0;
}
--
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA
mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/
- Raw text -