src/lib/serial.c
uint64_t unserial_uint64(uint8_t * * const ptr)
{
    uint64_t v;

    if (bigendian()) {
        memcpy(&v, *ptr, sizeof(uint64_t));
    } else {
        int i;
        uint8_t rv[sizeof(uint64_t)];
        uint8_t *pv = (uint8_t *) &v;

        memcpy(&v, *ptr, sizeof(uint64_t));
        for (i = 0; i < 8; i++) {
            rv[i] = pv[7 - i];
        }
        memcpy(&v, &rv, sizeof(uint64_t));
    }
    *ptr += sizeof(uint64_t);
    return v;
}
/*  unserial_uint64  --  Unserialise an unsigned 64 bit integer.  */
unserial_uint64  --  Unserialise an unsigned 64 bit integer.
unserial_uint64 -- Unserialise an unsigned 64 bit integer .
uint64_t unserial_uint64(uint8_t * * const ptr)
{
    uint64_t v;
    if (bigendian()) {
        memcpy(&v, *ptr, sizeof(uint64_t));
    } else {
        int i;
        uint8_t rv[sizeof(uint64_t)];
        uint8_t *pv = (uint8_t *) &v;
        memcpy(&v, *ptr, sizeof(uint64_t));
        for (i = 0; i < 8; i++) {
            rv[i] = pv[7 - i];
        }
        memcpy(&v, &rv, sizeof(uint64_t));
    }
    *ptr += sizeof(uint64_t);
    return v;
}
uint64_t unserial_uint64 ( uint8_t * * const ptr ) { uint64_t v ; if ( bigendian ( ) ) { memcpy ( & v , * ptr , sizeof ( uint64_t ) ) ; } else { int i ; uint8_t rv [ sizeof ( uint64_t ) ] ; uint8_t * pv = ( uint8_t * ) & v ; memcpy ( & v , * ptr , sizeof ( uint64_t ) ) ; for ( i = 0 ; i < 8 ; i ++ ) { rv [ i ] = pv [ 7 - i ] ; } memcpy ( & v , & rv , sizeof ( uint64_t ) ) ; } * ptr += sizeof ( uint64_t ) ; return v ; }
unserial_uint64  --  Unserialise an unsigned 64 bit integer.
unserial_uint64 -- Unserialise an unsigned 64 bit integer .