PostGIS  2.2.7dev-r@@SVN_REVISION@@
static double double_from_wkb_state ( wkb_parse_state s)
static

Double Read an 8-byte double and advance the parse state forward.

Definition at line 283 of file lwin_wkb.c.

References wkb_parse_state::pos, wkb_parse_state::swap_bytes, WKB_DOUBLE_SIZE, and wkb_parse_state_check().

Referenced by lwpoint_from_wkb_state(), and ptarray_from_wkb_state().

284 {
285  double d = 0;
286 
288 
289  memcpy(&d, s->pos, WKB_DOUBLE_SIZE);
290 
291  /* Swap? Copy into a stack-allocated integer. */
292  if( s->swap_bytes )
293  {
294  int i = 0;
295  uint8_t tmp;
296 
297  for( i = 0; i < WKB_DOUBLE_SIZE/2; i++ )
298  {
299  tmp = ((uint8_t*)(&d))[i];
300  ((uint8_t*)(&d))[i] = ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1];
301  ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1] = tmp;
302  }
303 
304  }
305 
306  s->pos += WKB_DOUBLE_SIZE;
307  return d;
308 }
#define WKB_DOUBLE_SIZE
Well-Known Binary (WKB) Output Variant Types.
static void wkb_parse_state_check(wkb_parse_state *s, size_t next)
Check that we are not about to read off the end of the WKB array.
Definition: lwin_wkb.c:111
const uint8_t * pos
Definition: lwin_wkb.c:32

Here is the call graph for this function:

Here is the caller graph for this function: