-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incremental improvements in the web server/client
* Begin support for parsing flexbuffers in the client, just the initial addition of the flexbuffer parser. * Begin support for invoking verbs from the client.
- Loading branch information
Showing
16 changed files
with
1,513 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { BitWidth } from './bit-width.js'; | ||
export function toByteWidth(bitWidth) { | ||
return 1 << bitWidth; | ||
} | ||
export function iwidth(value) { | ||
if (value >= -128 && value <= 127) return BitWidth.WIDTH8; | ||
if (value >= -32768 && value <= 32767) return BitWidth.WIDTH16; | ||
if (value >= -2147483648 && value <= 2147483647) return BitWidth.WIDTH32; | ||
return BitWidth.WIDTH64; | ||
} | ||
export function fwidth(value) { | ||
return value === Math.fround(value) ? BitWidth.WIDTH32 : BitWidth.WIDTH64; | ||
} | ||
export function uwidth(value) { | ||
if (value <= 255) return BitWidth.WIDTH8; | ||
if (value <= 65535) return BitWidth.WIDTH16; | ||
if (value <= 4294967295) return BitWidth.WIDTH32; | ||
return BitWidth.WIDTH64; | ||
} | ||
export function fromByteWidth(value) { | ||
if (value === 1) return BitWidth.WIDTH8; | ||
if (value === 2) return BitWidth.WIDTH16; | ||
if (value === 4) return BitWidth.WIDTH32; | ||
return BitWidth.WIDTH64; | ||
} | ||
export function paddingSize(bufSize, scalarSize) { | ||
return ~bufSize + 1 & scalarSize - 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export var BitWidth; | ||
(function(BitWidth) { | ||
BitWidth[BitWidth["WIDTH8"] = 0] = "WIDTH8"; | ||
BitWidth[BitWidth["WIDTH16"] = 1] = "WIDTH16"; | ||
BitWidth[BitWidth["WIDTH32"] = 2] = "WIDTH32"; | ||
BitWidth[BitWidth["WIDTH64"] = 3] = "WIDTH64"; | ||
})(BitWidth || (BitWidth = {})); |
Oops, something went wrong.