Variable Byte Coding
Assign Onward uses a variable byte encoding scheme to represent data type codes, sizes of variable length data and integers which will not exceed 63 bits in magnitude. The scheme represents 64 bit signed integers using one to 10 bytes. The least significant bit of the first byte is the sign bit, set indicates negative. In the range 0-63, the coding scheme is the same as a single unsigned byte multiplied by 2. When a byte has the most significant bit set, that indicates that the following byte is also included in the code, and that seven more significant bits are stored in it.*Currently, Assign Onward only recognizes variable byte codes up to 10 bytes in length, so a 1 in the most significant bit of the 10th byte is an error, unrecognized code. Also, 64 bit signed integers are used to hold the VBC values, so most of the bits in a 10th byte (if present) are ignored.
Each byte encodes 7 bits, with the least significant bits coming in the first byte.
Assign Onward
3 June 2018
MIT License
Copyright (c) 2018 Assign Onward
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.