| Conditions | 3 |
| Total Lines | 18 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import struct |
||
| 28 | def byte_swap_64_bit(x): |
||
| 29 | x_type = type(x) |
||
| 30 | if x_type is float: |
||
| 31 | x = struct.unpack('>Q', struct.pack('>d', x))[0] |
||
| 32 | |||
| 33 | a = ((x >> 8) & 0x00FF000000000000) |
||
| 34 | b = ((x << 8) & 0xFF00000000000000) |
||
| 35 | c = ((x >> 8) & 0x000000FF00000000) |
||
| 36 | d = ((x << 8) & 0x0000FF0000000000) |
||
| 37 | e = ((x >> 8) & 0x0000000000FF0000) |
||
| 38 | f = ((x << 8) & 0x00000000FF000000) |
||
| 39 | g = ((x >> 8) & 0x00000000000000FF) |
||
| 40 | h = ((x << 8) & 0x000000000000FF00) |
||
| 41 | |||
| 42 | if x_type is float: |
||
| 43 | return struct.unpack('>d', struct.pack('>Q', b | a | d | c | f | e | h | g))[0] |
||
| 44 | else: |
||
| 45 | return b | a | d | c | f | e | h | g |
||
| 46 |