PostGIS  3.0.6dev-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 310 of file lwin_wkb.c.

311 {
312  double d = 0;
313 
314  memcpy(&d, s->pos, WKB_DOUBLE_SIZE);
315 
316  /* Swap? Copy into a stack-allocated integer. */
317  if( s->swap_bytes )
318  {
319  int i = 0;
320  uint8_t tmp;
321 
322  for( i = 0; i < WKB_DOUBLE_SIZE/2; i++ )
323  {
324  tmp = ((uint8_t*)(&d))[i];
325  ((uint8_t*)(&d))[i] = ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1];
326  ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1] = tmp;
327  }
328 
329  }
330 
331  s->pos += WKB_DOUBLE_SIZE;
332  return d;
333 }
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: