|
|
On Tue, 29 Apr 2008 16:31:17 +1200, Ian Collins <ian-news@xxxxxxxxxxx>
wrote:
>Thad Smith wrote:
>> Ian Collins wrote:
>>> thomas.mertes@xxxxxx wrote:
>>>> On 28 Apr., 23:32, Ian Collins <ian-n...@xxxxxxxxxxx> wrote:
>>>>> Alef Veld wrote:
>>>>>> 2. How far can you shift or divide ? To the max of the power of 2
>>>>>> within
>>>>>> the boundaries of a unsigned int ? (i'm only doing shifts on unsigned
>>>>>> ints for now)
>>>>> Four an unsigned int, you can shift up to the number of bits in the
>>>>> type.
>>>> According to C89: The result (of a shift) is undefined if
>>>> the right operand is negative, or greater than or equal to
>>>> the number of bits in the left expression's type.
>>>>
>>> Good catch. You spotted the deliberate mistake :)
>>
>> I don't see the mistake. "Up to" means less than with an implied
>> starting point, in this case of 0. Thus shifting up to 32 bits means
>> shifting 0 to 31 bits. "Up to and including" includes the limit.
>>
>In mathematical terms maybe, but not in idiomatic English. If a car
>claims to seat up to five adults, it seats five, not four.
Actually only three, except for very small values of five or adults.
Remove del for email
|
|