On 06/27/2012 04:15 PM, Avi Kivity wrote:
> On 06/27/2012 01:29 PM, Peter Maydell wrote:
>> Add field32() and field64() functions which extract a particular
>> bit field from a word and return it. Based on an idea by Jia Liu.
>> 
>>  
>> +/**
>> + * field64 - return a specified bit field from a uint64_t value
>> + * @value: The value to extract the bit field from
>> + * @start: The lowest bit in the bit field (numbered from 0)
>> + * @length: The length of the bit field
>> + *
>> + * Returns the value of the bit field extracted from the input value.
>> + */
>> +static inline uint64_t field64(uint64_t value, int start, int length)
>> +{
>> +    assert(start >= 0 && start <= 63 && length > 0 && start + length <= 64);
>> +    return (value >> start) & (~0ULL >> (64 - length));
>> +}
>> +
> 
> Undefined for length == 64, so better add that to the assert.

Er, please ignore.  It's undefined for length == 0, but that's
uninteresting and protected by the assert.


-- 
error compiling committee.c: too many arguments to function



Reply via email to