* lo_hton64 * converts a 64-bit integer from host byte order to network byte order */
| 1040 | * converts a 64-bit integer from host byte order to network byte order |
| 1041 | */ |
| 1042 | static pg_int64 |
| 1043 | lo_hton64(pg_int64 host64) |
| 1044 | { |
| 1045 | union |
| 1046 | { |
| 1047 | pg_int64 i64; |
| 1048 | uint32 i32[2]; |
| 1049 | } swap; |
| 1050 | uint32 t; |
| 1051 | |
| 1052 | /* High order half first, since we're doing MSB-first */ |
| 1053 | t = (uint32) (host64 >> 32); |
| 1054 | swap.i32[0] = pg_hton32(t); |
| 1055 | |
| 1056 | /* Now the low order half */ |
| 1057 | t = (uint32) host64; |
| 1058 | swap.i32[1] = pg_hton32(t); |
| 1059 | |
| 1060 | return swap.i64; |
| 1061 | } |
| 1062 | |
| 1063 | /* |
| 1064 | * lo_ntoh64 |
no outgoing calls
no test coverage detected