From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: QUAD_WORD (unsigned long long) bit testing Date: Fri, 14 Nov 1997 17:49:40 -0500 Organization: Cornell University http://www.cornell.edu Lines: 49 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <346CD584.F0A15C04@cornell.edu> References: <346C8264 DOT 4C58AAA1 AT lausd DOT k12 DOT ca DOT us> Reply-To: asu1 AT cornell DOT edu NNTP-Posting-Host: cu-dialup-0059.cit.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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): type: info gcc index "long long" press enter. try out: #include #include #include 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/