Next in thread → Next in month →

Re: [pkcs11] Ones Complement versus Twos Complement - RE: Use CK_UNAVAILABLE_INFORMATION

From
Stef Walter <>
Date
2013-06-18T14:58:29+00:00
ID
Thread
Re: [pkcs11] Ones Complement versus Twos Complement - RE: Use CK_UNAVAILABLE_INFORMATION
On 13.06.2013 01:07, Tim Hudson wrote:
> Here is a proposal for consideration:
> 
> For PKCS11 v2.40 change the current definition of:
>     #define CK_UNAVAILABLE_INFORMATION (~0UL)
> To the following:
>     #define CK_UNAVAILABLE_INFORMATION ((CK_ULONG)-1) 
> 
> I believe this actually matches the original intent of the define - and
> that allowance for a ones-complement representation of negative numbers
> was simply overlooked.

Was the original intent to have a CK_ULONG with all bits set to one?
Because to me "(CK_ULONG)-1" seems meaningless without making such an
assumption. If that's the case, then ~OUL represents exactly that: an
unsigned long with all bits set to 1.

So unless I'm wrong above, I would be in favor of keeping the current
definition. As Wan-Teh said, it's clearer.

Cheers,

Stef
Next in thread → Next in month →