[FAST-25] Integer fields cannot encode value 16384 (2^14) Created: 13/Oct/09 Updated: 15/Feb/11 |
|
| Status: | Open |
| Project: | OpenFAST |
| Component/s: | Operators, Types |
| Affects Version/s: | 1.0.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Alexander Kosenkov | Assignee: | Jacob Northey |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Value 16384 is not encoded as 16385. |
| Comments |
| Comment by Alexander Kosenkov [ 13/Oct/09 ] |
|
public class IntegerCodecTest { @Test private void test(UnsignedInteger codec, int expected) { final byte[] bytes = codec.encode(new IntegerValue(expected)); final ScalarValue value = codec.decode(new ByteArrayInputStream(bytes)); final int actual = value.toInt(); Assert.assertEquals("encoding " + expected,expected,actual); }} |
| Comment by Alexander Kosenkov [ 13/Oct/09 ] |
|
You should replace "<=" with "<" in getUnsignedIntegerSize() |
| Comment by Brian Davis [ 15/Feb/11 ] |
|
Alexander's comment is true for all predicates in getUnsignedIntegerSize(). Here is the current implementation (checked out from SVN trunk on 15-Feb-2011): /**
Here is the equivalent function from the C language reference implementation available from the FIX protocol website (http://www.fixprotocol.org/documents/2317/fastapi-1.0.zip, fastapi-1.0/fastapi.c): static int u32_to_size (u32 data) return 5; |