Last change
on this file since 57541 was 53726, checked in by vboxsync, 10 years ago |
properties.
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
585 bytes
|
Line | |
---|
1 | #include "chromium.h"
|
---|
2 | #include "cr_endian.h"
|
---|
3 |
|
---|
4 | char 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 |
|
---|
28 | double 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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.