Press "Enter" to skip to content

C++判断本机的字节序的方法

 

1bool isBigEnding(){
    
int i = 1;
    
return ((char)i) == 1;
}

2bool isBigEnding(){
    union 
{
       
int i;
       
char c;
   }
x={1};
   
return x.c == 1;
}


3. bool isBigEnding{
   union 
{
      
int i ;
      
struct {
          unsigned 
short int b : 8;
      }
bit;
   }
x={1};
   
return x.bit.b == 1;
}

2 Comments

  1. Deleting the history of is necessary to protect your data from other user of the system and also for increasing the browsing speed of bing history deletion is important.

  2. happywheelsnow.com
    happywheelsnow.com 2017-12-30

    I didn’t find this kind of information till now. Thank you so much for sharing this information.

Leave a Reply

Your email address will not be published. Required fields are marked *