Skip to content
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

Closed
dnbllglm opened this issue May 17, 2017 · 7 comments

Comments

@dnbllglm
Copy link

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

@billsegall
Copy link
Contributor

billsegall commented May 17, 2017 via email

@dnbllglm
Copy link
Author

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

@billsegall
Copy link
Contributor

billsegall commented May 17, 2017 via email

@mjpt777
Copy link
Contributor

mjpt777 commented May 18, 2017

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?

@tmontgomery
Copy link
Contributor

@mjpt777 I believe the change you made is good. Not sure why the values were that way off hand.

@da4089
Copy link

da4089 commented May 22, 2017

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?

@mjpt777
Copy link
Contributor

mjpt777 commented May 22, 2017

@da4089 Agreed.

@mjpt777 mjpt777 closed this as completed May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants