VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/util/endian.c@ 53038

最後變更 在這個檔案從53038是 15532,由 vboxsync 提交於 16 年 前

crOpenGL: export to OSE

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 585 位元組
 
1#include "chromium.h"
2#include "cr_endian.h"
3
4char crDetermineEndianness( void )
5{
6 union {
7 struct {
8 char c1;
9 char c2;
10 char c3;
11 char c4;
12 } c;
13 unsigned int i;
14 } e_test;
15
16 e_test.c.c1 = 1;
17 e_test.c.c2 = 2;
18 e_test.c.c3 = 3;
19 e_test.c.c4 = 4;
20
21 if (e_test.i == 0x01020304)
22 {
23 return CR_BIG_ENDIAN;
24 }
25 return CR_LITTLE_ENDIAN;
26}
27
28double SWAPDOUBLE( double d )
29{
30 CR64BitType *ptr = (CR64BitType *) (&d);
31#ifdef __STDC__
32 CR64BitType swapped;
33 SWAP64( *ptr );
34 swapped = *ptr;
35#else
36 CR64BitType swapped = SWAP64( *ptr );
37#endif
38 return *((double *) (&swapped));
39}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette