PostgreSQL Source Code  git master
pg_bswap.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define pg_hton16(x)   pg_bswap16(x)
 
#define pg_hton32(x)   pg_bswap32(x)
 
#define pg_hton64(x)   pg_bswap64(x)
 
#define pg_ntoh16(x)   pg_bswap16(x)
 
#define pg_ntoh32(x)   pg_bswap32(x)
 
#define pg_ntoh64(x)   pg_bswap64(x)
 

Functions

static uint16 pg_bswap16 (uint16 x)
 
static uint32 pg_bswap32 (uint32 x)
 
static uint64 pg_bswap64 (uint64 x)
 

Macro Definition Documentation

◆ pg_hton16

#define pg_hton16 (   x)    pg_bswap16(x)

Definition at line 120 of file pg_bswap.h.

◆ pg_hton32

#define pg_hton32 (   x)    pg_bswap32(x)

Definition at line 121 of file pg_bswap.h.

◆ pg_hton64

#define pg_hton64 (   x)    pg_bswap64(x)

Definition at line 122 of file pg_bswap.h.

◆ pg_ntoh16

#define pg_ntoh16 (   x)    pg_bswap16(x)

Definition at line 124 of file pg_bswap.h.

◆ pg_ntoh32

#define pg_ntoh32 (   x)    pg_bswap32(x)

Definition at line 125 of file pg_bswap.h.

◆ pg_ntoh64

#define pg_ntoh64 (   x)    pg_bswap64(x)

Definition at line 126 of file pg_bswap.h.

Function Documentation

◆ pg_bswap16()

static uint16 pg_bswap16 ( uint16  x)
inlinestatic

Definition at line 42 of file pg_bswap.h.

43 {
44  return
45  ((x << 8) & 0xff00) |
46  ((x >> 8) & 0x00ff);
47 }
int x
Definition: isn.c:71

References x.

◆ pg_bswap32()

static uint32 pg_bswap32 ( uint32  x)
inlinestatic

Definition at line 64 of file pg_bswap.h.

65 {
66  return
67  ((x << 24) & 0xff000000) |
68  ((x << 8) & 0x00ff0000) |
69  ((x >> 8) & 0x0000ff00) |
70  ((x >> 24) & 0x000000ff);
71 }

References x.

Referenced by network_abbrev_convert().

◆ pg_bswap64()

static uint64 pg_bswap64 ( uint64  x)
inlinestatic

Definition at line 89 of file pg_bswap.h.

90 {
91  return
92  ((x << 56) & UINT64CONST(0xff00000000000000)) |
93  ((x << 40) & UINT64CONST(0x00ff000000000000)) |
94  ((x << 24) & UINT64CONST(0x0000ff0000000000)) |
95  ((x << 8) & UINT64CONST(0x000000ff00000000)) |
96  ((x >> 8) & UINT64CONST(0x00000000ff000000)) |
97  ((x >> 24) & UINT64CONST(0x0000000000ff0000)) |
98  ((x >> 40) & UINT64CONST(0x000000000000ff00)) |
99  ((x >> 56) & UINT64CONST(0x00000000000000ff));
100 }

References x.

Referenced by for(), and uuid_2_double().