Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Motivation: Makes it possible to make integers out of ByteBuffers directly with an initializer. I.e. `UInt32(buffer: ByteBuffer(bytes: [0, 1, 2, 3]))`. Closes #3012. ### Modifications: - Adds the `Int(buffer:)` initializer in `ByteBuffer-int.swift` - Adds tests in `ByteBufferTest.swift`. _Holy hell this file is huge._ - Note that `Int(buffer:)` will crash if the buffer does not have enough bytes in it to represent the desired integer type. - It also does _not_ expose endianness and uses `Endianness.host`, to keep the public API clean and simple. It's a convenience initializer, so I thought keeping it minimal is a good idea. ### Result: Nicer direct initializer for integers from ByteBuffers. --------- Co-authored-by: Johannes Weiss <[email protected]> Co-authored-by: Cory Benfield <[email protected]>
- Loading branch information