PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ double_from_wkb_state()

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 317 of file lwin_wkb.c.

318 {
319  double d = 0;
320 
321  memcpy(&d, s->pos, WKB_DOUBLE_SIZE);
322 
323  /* Swap? Copy into a stack-allocated integer. */
324  if( s->swap_bytes )
325  {
326  int i = 0;
327  uint8_t tmp;
328 
329  for( i = 0; i < WKB_DOUBLE_SIZE/2; i++ )
330  {
331  tmp = ((uint8_t*)(&d))[i];
332  ((uint8_t*)(&d))[i] = ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1];
333  ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1] = tmp;
334  }
335 
336  }
337 
338  s->pos += WKB_DOUBLE_SIZE;
339  return d;
340 }
char * s
Definition: cu_in_wkt.c:23
#define WKB_DOUBLE_SIZE
Well-Known Binary (WKB) Output Variant Types.

References s, and WKB_DOUBLE_SIZE.

Referenced by lwpoint_from_wkb_state(), and ptarray_from_wkb_state().

Here is the caller graph for this function: