-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The max value and null value of uint type in PrimitiveValue.java is different from documentation of SBE. #455
Comments
See section 2.4.2 of the specification at
http://www.fixtradingcommunity.org/pg/file/fplpo/read/1196757/simple-binary-encoding-release-candidate-2
.
Essentially this results from the default NullValue being 2**n -1 for an n
bit unsigned type so 2**n -2 was used for MaxValue for these types. Signed
types behave as you probably expect them to because they use -2**n for
NullValue.
It's far from intuitive but you can set min/max/null values in your schema
to be whatever you would prefer .
Bill.
…On Wed, May 17, 2017 at 1:10 PM, dnbllglm ***@***.***> wrote:
public static final long MIN_VALUE_UINT32 = 0;
public static final long MAX_VALUE_UINT32 = 4294967293L; // 0xFFFFFFFD
public static final long NULL_VALUE_UINT32 = 4294967294L; // 0xFFFFFFFE
There is some code that define some constant value of basic type of number
in PrimitiveValue.java.I can't understand why NULL_VALUE_UINT32 is
0xFFFFFFFE(2 ^ 32 - 2) instead of 0xFFFFFFFF(2 ^ 32 - 1), but
NULL_VALUE_UINT16 is 65535(2 ^ 16 - 1) and NULL_VALUE_UINT8 is 255(2 ^ 8 -
1).
The documentation is in Range attributes for integer fields
<https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/blob/master/v1-0-STANDARD/doc/02FieldEncoding.md#range-attributes-for-integer-fields>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#455>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFI1pEpEdIkRc4UchCSKp7L6BPeVbD5Hks5r6mULgaJpZM4NdUsr>
.
|
Thank you for answering my question,but it is using 0xFFFFFFFE as null value of unsigned int type and using 0xFFFFFFFD as max value for unsigned int type in PrimitiveType.java.In fact,we should use 0xFFFFFFFF as null value of unsigned int type and use 0xFFFFFFFE as max value of unsigned int type like unsigned short type and unsigned byte type,for example:
|
Sorry, I see the confusion now. I suspect this results from Java 7's lack
of support for unsigned ints but I'm unsure.
Bill.
…On Wed, May 17, 2017 at 5:19 PM, dnbllglm ***@***.***> wrote:
public static final long MIN_VALUE_UINT32 = 0;
public static final long MAX_VALUE_UINT32 = 4294967293L; // 0xFFFFFFFD
public static final long NULL_VALUE_UINT32 = 4294967294L; // 0xFFFFFFFE
Thank you for answering my question,but it is using 0xFFFFFFFE as null
value of unsigned int type and using 0xFFFFFFFD as max value for unsigned
int type in PrimitiveType.java.In fact,we should use 0xFFFFFFFF as null
value of unsigned int type and use 0xFFFFFFFE as max value of unsigned int
type like unsigned short type and unsigned byte type,for example:
public static final long MIN_VALUE_UINT32 = 0;
public static final long MAX_VALUE_UINT32 = 4294967294L; // 0xFFFFFFFE
public static final long NULL_VALUE_UINT32 = 4294967295L; // 0xFFFFFFFF
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#455 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFI1pDz1DJZytJlaEHN5NYXYnphcueShks5r6p-YgaJpZM4NdUsr>
.
|
I believed this may have been a hangover from early spec versions. I've pushed a correction. @tmontgomery is there something we might have missed here? |
@mjpt777 I believe the change you made is good. Not sure why the values were that way off hand. |
This probably should be highlighted in the release notes, since schemas/stubs using default NULL values (and perhaps, MAX, although that seems less likely to be commonly used) will be incompatible? |
@da4089 Agreed. |
There is some code that define some constant value of basic type of number in PrimitiveValue.java.I can't understand why NULL_VALUE_UINT32 is 0xFFFFFFFE(2 ^ 32 - 2) instead of 0xFFFFFFFF(2 ^ 32 - 1), but NULL_VALUE_UINT16 is 65535(2 ^ 16 - 1) and NULL_VALUE_UINT8 is 255(2 ^ 8 - 1).
The documentation is in Range attributes for integer fields
The text was updated successfully, but these errors were encountered: