FreeBSD/sys/geom/part/g_part_ldm.c
/* Read the variable-width numeric field and return new offset */
Read the variable-width numeric field and return new offset
Read the variable - width numeric field and return new offset
static int
ldm_vnum_get(const u_char *buf, int offset, uint64_t *result, size_t range)
{
	uint64_t num;
	uint8_t len;
	len = buf[offset++];
	if (len > sizeof(uint64_t) || len + offset >= range)
		return (-1);
	for (num = 0; len > 0; len--)
		num = (num << 8) | buf[offset++];
	*result = num;
	return (offset);
}
static int ldm_vnum_get ( const u_char * buf , int offset , uint64_t * result , size_t range ) { uint64_t num ; uint8_t len ; len = buf [ offset ++ ] ; if ( len > sizeof ( uint64_t ) || len + offset >= range ) return ( -1 ) ; for ( num = 0 ; len > 0 ; len -- ) num = ( num << 8 ) | buf [ offset ++ ] ; * result = num ; return ( offset ) ; }
Read the variable-width numeric field and return new offset
Read the variable - width numeric field and return new offset