PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ read_float64()

double read_float64 ( const uint8_t **  from,
uint8_t  littleEndian 
)

Definition at line 389 of file rt_serialize.c.

Referenced by rt_band_from_wkb(), rt_raster_deserialize(), and rt_raster_from_wkb().

389  {
390 
391  union {
392  double d;
393  uint64_t i;
394  } ret;
395 
396  assert(NULL != from);
397 
398  if (littleEndian) {
399  ret.i = (uint64_t) ((*from)[0] & 0xff) |
400  (uint64_t) ((*from)[1] & 0xff) << 8 |
401  (uint64_t) ((*from)[2] & 0xff) << 16 |
402  (uint64_t) ((*from)[3] & 0xff) << 24 |
403  (uint64_t) ((*from)[4] & 0xff) << 32 |
404  (uint64_t) ((*from)[5] & 0xff) << 40 |
405  (uint64_t) ((*from)[6] & 0xff) << 48 |
406  (uint64_t) ((*from)[7] & 0xff) << 56;
407  } else {
408  /* big endian */
409  ret.i = (uint64_t) ((*from)[7] & 0xff) |
410  (uint64_t) ((*from)[6] & 0xff) << 8 |
411  (uint64_t) ((*from)[5] & 0xff) << 16 |
412  (uint64_t) ((*from)[4] & 0xff) << 24 |
413  (uint64_t) ((*from)[3] & 0xff) << 32 |
414  (uint64_t) ((*from)[2] & 0xff) << 40 |
415  (uint64_t) ((*from)[1] & 0xff) << 48 |
416  (uint64_t) ((*from)[0] & 0xff) << 56;
417  }
418 
419  *from += 8;
420  return ret.d;
421 }
Here is the caller graph for this function: