~sircmpwn/public-inbox

1

BARE draft 6 feedback

Details
Message ID
<CJR8GB8XJI7H.2MFQML4K0HHF8@zach-macbookpro121>
DKIM signature
pass
Download raw message
The following syntax is confusing:

> Signed integers are represented as uint using a "zig-zag" encoding: positive values x are written as 2x + 0, negative values are written as 2(^x) + 1.

What does the '^' symbol mean? (and should I feel stupid for asking this question?)

From reading about zig-zag encoding, that should be
0		0
-1		1
1		2
-2		3
(i.e. there's no "negative zero" value encodable)

Would it not be better to say
"negative values are written as -2x - 1."?

This seems to match up with example values given in the document, where -63 is 0x7d.
(also, thanks to the example values, I realized my implementation was incorrect.)
Details
Message ID
<20220509162844.GB5191@gmail.com>
In-Reply-To
<CJR8GB8XJI7H.2MFQML4K0HHF8@zach-macbookpro121> (view parent)
DKIM signature
pass
Download raw message
> The following syntax is confusing:
> 
> > Signed integers are represented as uint using a "zig-zag" encoding:
> > positive values x are written as 2x + 0, negative values are written
> > as 2(^x) + 1.
> 
> What does the '^' symbol mean? (and should I feel stupid for asking
> this question?)

It's explained in the following sentence. No, you shouldn't, it should
be clear from the first sentence.

> Would it not be better to say
> "negative values are written as -2x - 1."?

Thanks, I've updated it [1].

[1]: https://git.sr.ht/~qeef/draft-devault-bare/commit/8cef667f6dac71386cb95bb05d56b825f9e92740
Reply to thread Export thread (mbox)