MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / xdr_hyper

Function xdr_hyper

src/common/xdr.cpp:97–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96
97bool_t xdr_hyper( xdr_t* xdrs, void* pi64)
98{
99/**************************************
100 *
101 * x d r _ h y p e r
102 *
103 **************************************
104 *
105 * Functional description
106 * Map a 64-bit Integer from external to internal representation
107 * (or vice versa).
108 *
109 * Handles "swapping" of the 2 long's to be "Endian" sensitive.
110 *
111 **************************************/
112 SLONG temp_long[2];
113
114 switch (xdrs->x_op)
115 {
116 case XDR_ENCODE:
117 memcpy(temp_long, pi64, sizeof temp_long);
118#ifndef WORDS_BIGENDIAN
119 if (PUTLONG(xdrs, &temp_long[1]) &&
120 PUTLONG(xdrs, &temp_long[0]))
121 {
122 return TRUE;
123 }
124#else
125 if (PUTLONG(xdrs, &temp_long[0]) &&
126 PUTLONG(xdrs, &temp_long[1]))
127 {
128 return TRUE;
129 }
130#endif
131 return FALSE;
132
133 case XDR_DECODE:
134#ifndef WORDS_BIGENDIAN
135 if (!GETLONG(xdrs, &temp_long[1]) ||
136 !GETLONG(xdrs, &temp_long[0]))
137 {
138 return FALSE;
139 }
140#else
141 if (!GETLONG(xdrs, &temp_long[0]) ||
142 !GETLONG(xdrs, &temp_long[1]))
143 {
144 return FALSE;
145 }
146#endif
147 memcpy(pi64, temp_long, sizeof temp_long);
148 return TRUE;
149
150 case XDR_FREE:
151 return TRUE;
152 }
153 // TMN: added compiler silencier return FALSE.
154 return FALSE;

Callers 3

CAN_encode_decodeFunction · 0.85
xdr_datumFunction · 0.85
xdr_int128Function · 0.85

Calls 2

PUTLONGFunction · 0.85
GETLONGFunction · 0.85

Tested by

no test coverage detected