Skip to content

Commit

Permalink
Merge pull request #30 from samoht/varints
Browse files Browse the repository at this point in the history
Improve performance for encoding varints
  • Loading branch information
samoht authored Dec 18, 2020
2 parents 03ae79d + d8d969a commit 653ffd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
### 0.2.0 (2020-12-18)

- Improve performance of variable-size integers encoding. (#24, @samoht)
- Require `short_hash` operations to be explicitly unstaged. (#15, @CraigFe)
- Require `equal` and `compare` operations to be explicitly unstaged. (#16, @samoht)
- Improve performance of variable-size integers encoding and decoding.
(#24, #30, @samoht)
- Require `short_hash` operations to be explicitly unstaged.
(#15, @CraigFe)
- Require `equal` and `compare` operations to be explicitly unstaged.
(#16, @samoht)

### 0.1.0 (2020-10-16)

Expand Down
6 changes: 3 additions & 3 deletions src/repr/type_binary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ module Encode = struct
let bool b = char (if b then '\255' else '\000')

let int i k =
let rec aux n =
let rec aux n k =
if n >= 0 && n < 128 then k chars.(n)
else
let out = 128 lor (n land 127) in
k chars.(out);
aux (n lsr 7)
aux (n lsr 7) k
in
aux i
aux i k

let len n i =
match n with
Expand Down

0 comments on commit 653ffd9

Please sign in to comment.