Skip to content

Commit

Permalink
Merge pull request #139 from saxbophone/develop
Browse files Browse the repository at this point in the history
v0.21.2
  • Loading branch information
saxbophone authored Nov 13, 2016
2 parents 04d4ccb + 958433f commit 7dffe00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# begin basic metadata
cmake_minimum_required(VERSION 3.0)

project(libsaxbospiral VERSION 0.21.1 LANGUAGES C)
project(libsaxbospiral VERSION 0.21.2 LANGUAGES C)

# set default C standard to use (C99) if not already set
if(NOT DEFINED SAXBOSPIRAL_C_STANDARD)
Expand Down
4 changes: 2 additions & 2 deletions saxbospiral/initialise.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ sxbp_status_t sxbp_init_spiral(sxbp_buffer_t buffer, sxbp_spiral_t* spiral) {
*/
for(size_t s = 0; s < buffer.size; s++) {
// byte-level loop
for(size_t b = 0; b < 8; b++) {
for(uint8_t b = 0; b < 8; b++) {
// bit level loop
uint8_t e = 7 - b; // which power of two to use with bit mask
uint8_t bit = (buffer.bytes[s] & (1 << e)) >> e; // the current bit
size_t index = (s * 8) + b + 1; // line index
size_t index = (s * 8) + (size_t)b + 1; // line index
sxbp_rotation_t rotation; // the rotation we're going to make
// set rotation direction based on the current bit
rotation = (bit == 0) ? SXBP_CLOCKWISE : SXBP_ANTI_CLOCKWISE;
Expand Down
4 changes: 2 additions & 2 deletions saxbospiral/serialise.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static uint64_t load_uint64_t(sxbp_buffer_t* buffer, size_t start_index) {
// preconditional assertions
assert(buffer->bytes != NULL);
uint64_t value = 0;
for(size_t i = 0; i < 8; i++) {
for(uint8_t i = 0; i < 8; i++) {
value |= (buffer->bytes[start_index + i]) << (8 * (7 - i));
}
return value;
Expand All @@ -65,7 +65,7 @@ static uint32_t load_uint32_t(sxbp_buffer_t* buffer, size_t start_index) {
// preconditional assertions
assert(buffer->bytes != NULL);
uint32_t value = 0;
for(size_t i = 0; i < 4; i++) {
for(uint8_t i = 0; i < 4; i++) {
value |= (buffer->bytes[start_index + i]) << (8 * (3 - i));
}
return value;
Expand Down

0 comments on commit 7dffe00

Please sign in to comment.