PostGIS  2.1.10dev-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 280 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().

281 {
282  double d = 0;
283 
285 
286  memcpy(&d, s->pos, WKB_DOUBLE_SIZE);
287 
288  /* Swap? Copy into a stack-allocated integer. */
289  if( s->swap_bytes )
290  {
291  int i = 0;
292  uint8_t tmp;
293 
294  for( i = 0; i < WKB_DOUBLE_SIZE/2; i++ )
295  {
296  tmp = ((uint8_t*)(&d))[i];
297  ((uint8_t*)(&d))[i] = ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1];
298  ((uint8_t*)(&d))[WKB_DOUBLE_SIZE - i - 1] = tmp;
299  }
300 
301  }
302 
303  s->pos += WKB_DOUBLE_SIZE;
304  return d;
305 }
#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:108
const uint8_t * pos
Definition: lwin_wkb.c:29

Here is the call graph for this function:

Here is the caller graph for this function: