Skip to content

Evaluate use of unsigned numbers for public API #368

Open
@JakeWharton

Description

@JakeWharton

Okio was written in Java before being ported to Kotlin, and binary compatibility meant we retained the use of signed numbers. With this library being a fresh take on its design, there is an opportunity to switch to unsigned numbers where it makes sense (and if it makes sense).

It certainly would be nice to never have to check values for being negative all over the place in the internals.

The concern, of course, is that there is enough overhead to make this not worthwhile. Or that the conversion ceremony is too much boilerplate.

I suspect the unsafe internals and unsafe APIs will still likely use signed ByteArray and signed Ints, but perhaps the size and indexing of Buffer/ByteString and all their APIs could switch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions