I run the code by eyes :)))

Reply to this note

Please Login to reply.

Discussion

You have great eyes! :D

Thank you for auditing my shitty rust code. My first ever rust repo, lol.

But 280 and 50 are very similar to how the length of bytes to a string correlates with utf-8. For the largest character with 32 bits, 6 bytes are needed. Maybe you took this piece of code with such an original meaning somewhere?

P.S. I don't know the Rust and don't know length method of string there... :) (Bytes or utf-8 characters?)

https://doc.rust-lang.org/nightly/std/primitive.str.html#method.len

It's in bytes. So for utf-8 to be need multiplication x6 but better to use utf-8 libraries IMHO

Cool, I’ll fix it.

Yeah I took that return json from a JS version or nips repo. Can’t remember.