Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to do bit shift in __int64??

Status
Not open for further replies.

boeysue

Full Member level 3
Joined
Dec 23, 2004
Messages
187
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,296
Activity points
1,523
bitwise shift __int64

__int64 i=0;

i>>=9;

why i is not 0??

and how to do in the right shift??
 

__int64 to zero

divide it by 2
 

__int64 shift

Is this C? That __int64 sounds like a language extension provided by your compiler. If it is a 64 bit integer type, then your right-shift should work fine. Maybe the way you tested i is incorrect. Tell us which compiler you are using, and show us a small complete program that demonstrates the problem, and maybe we can help you find the trouble.

For example, MinGW (gcc 3.4.2) provides __int64, and this correctly prints "i is zero":

Code:
#include <stdio.h>

int main(void)
{
  __int64 i=0;

  i >>= 9;
  if (i == 0)
    printf("i is zero\n");
  else
    printf("i is not zero\n");
  return 0;
}
 

hi,
I have also checked on sun compiler it is working perfectly fine,....
 

hi all
also working fine with MinGW 2.05(under winxp)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top