diff options
Diffstat (limited to 'src/stream.cpp')
-rw-r--r-- | src/stream.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/stream.cpp b/src/stream.cpp index 8846414..f3dd322 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -1,9 +1,8 @@ +#ifdef SALTICIDAE_CBINDINGS #include "salticidae/stream.h" using namespace salticidae; -#ifdef __cplusplus - extern "C" { uint256_t *uint256_new() { return new uint256_t(); } @@ -56,6 +55,30 @@ void datastream_put_data(datastream_t *self, self->put_data(begin, end); } +uint8_t datastream_get_u8(datastream_t *self) { + uint8_t val; *self >> val; return val; +} + +uint16_t datastream_get_u16(datastream_t *self) { + uint16_t val; *self >> val; return val; +} + +uint32_t datastream_get_u32(datastream_t *self) { + uint32_t val; *self >> val; return val; +} + +int8_t datastream_get_i8(datastream_t *self) { + int8_t val; *self >> val; return val; +} + +int16_t datastream_get_i16(datastream_t *self) { + int16_t val; *self >> val; return val; +} + +int32_t datastream_get_i32(datastream_t *self) { + int32_t val; *self >> val; return val; +} + const uint8_t *datastream_get_data_inplace(datastream_t *self, size_t len) { return self->get_data_inplace(len); } |