Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
) Summary: ## Motivation `JByteBuffer`s could only be initialized with `nativeOrder` endianness. With this PR, both `littleEndian()` and `bigEndian()` fields are exposed in `JByteOrder` and can now be set through `JByteBuffer::order(...)`. Get static fields `LITTLE_ENDIAN` and `BIG_ENDIAN` through `JByteOrder`. Pull Request resolved: #93 Test Plan: Test code: Default: ```cpp auto buffer = JByteBuffer::allocateDirect(5); uint8_t* data = buffer->getDirectData(); data[0] = 255; data[1] = 1; __android_log_print(ANDROID_LOG_INFO, "Test", "First item: %i", data[0]); ``` With custom Endian: ```cpp auto buffer = JByteBuffer::allocateDirect(5); buffer->order(JByteOrder::bigEndian()); // <-- or littleEndian() uint8_t* data = buffer->getDirectData(); data[0] = 255; data[1] = 1; __android_log_print(ANDROID_LOG_INFO, "Test", "First item: %i", data[0]); ``` Reviewed By: cipolleschi Differential Revision: D53089814 Pulled By: cortinico fbshipit-source-id: 4f683ccba46caf5a62842944d44b3a201473f522
- Loading branch information