On 06/27/2012 05:24 PM, Markus Armbruster wrote:
> Avi Kivity writes:
>
>> On 06/27/2012 04:28 PM, Eric Blake wrote:
> [...]
>>> You marked this function signature as returning uint64_t, but didn't
>>> return anything. I think the logical return is the new contents of
>>> *pvalue. Another logic
Avi Kivity writes:
> On 06/27/2012 04:28 PM, Eric Blake wrote:
[...]
>> You marked this function signature as returning uint64_t, but didn't
>> return anything. I think the logical return is the new contents of
>> *pvalue. Another logical choice would be marking the function void.
>>
>
> Void
On 06/27/2012 04:28 PM, Eric Blake wrote:
> On 06/27/2012 07:15 AM, 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.
>>>
>
>>> +static inline
On 06/27/2012 04:22 PM, Peter Maydell wrote:
> On 27 June 2012 14:15, Avi Kivity wrote:
>> I suggest adding the analogous functions for writing. I believe the
>> common naming is extract/deposit.
>>
>> static inline uint64_t deposit64(uint64_t *pvalue, unsigned start,
>>
On 06/27/2012 07:15 AM, 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.
>>
>> +static inline uint64_t field64(uint64_t value, int start, int len
On 27 June 2012 14:15, Avi Kivity wrote:
> I suggest adding the analogous functions for writing. I believe the
> common naming is extract/deposit.
>
> static inline uint64_t deposit64(uint64_t *pvalue, unsigned start,
> unsigned length, uint64_t fieldval)
> {
>
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 uin
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
Eric Blake wrote:
> assert(start >= 0 && length > 0 && (unsigned) start + length <= 64);
This is shorter and avoids the ugly cast:
assert(start >= 0 && length > 0 && length <= 64 - start);
Jay.
On 27 June 2012 12:39, Eric Blake wrote:
> On 06/27/2012 04:29 AM, Peter Maydell wrote:
>> +static inline uint64_t field64(uint64_t value, int start, int length)
>> +{
>> + assert(start >= 0 && start <= 63 && length > 0 && start + length <= 64);
>
> You're failing to account for wraparound:
>
>
On 27 June 2012 12:29, Andreas Färber wrote:
> Do you have followup patches that make use of this? Might illustrate
> what variables and types are being passed in.
Here's a random snippet from the LPAE patch I'm working on:
uint32_t t0sz = field32(env->cp15.c2_control, 0, 3);
uint32_t t1
On 06/27/2012 04:29 AM, 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.
>
> +static inline uint64_t field64(uint64_t value, int start, int length)
> +{
> +assert(start >= 0 && start <=
Am 27.06.2012 12:29, schrieb Peter Maydell:
> Add field32() and field64() functions which extract a particular
> bit field from a word and return it. Based on an idea by Jia Liu.
>
> Suggested-by: Jia Liu
> Signed-off-by: Peter Maydell
> ---
> v1->v2: added missing brackets to field32() to bring
Add field32() and field64() functions which extract a particular
bit field from a word and return it. Based on an idea by Jia Liu.
Suggested-by: Jia Liu
Signed-off-by: Peter Maydell
---
v1->v2: added missing brackets to field32() to bring it in to line
with field64()
(Still using 'int' r
14 matches
Mail list logo