[ion] remove crc32Padded

This commit is contained in:
Léa Saviot
2019-04-25 16:11:09 +02:00
parent 380ac52cd8
commit 2cc222856e
7 changed files with 0 additions and 34 deletions

View File

@@ -22,7 +22,6 @@ initializer_list = $(shell echo $(1) | sed "s/\(.\)/'\1',/g")0
$(call object_for,ion/src/shared/platform_info.cpp): SFLAGS += -DPATCH_LEVEL="$(call initializer_list,$(PATCH_LEVEL))" -DEPSILON_VERSION="$(call initializer_list,$(EPSILON_VERSION))"
src += $(addprefix ion/src/shared/, \
crc32_padded.cpp \
decompress.cpp \
events.cpp \
led.cpp \

View File

@@ -9,7 +9,6 @@ src += $(addprefix ion/src/shared/, \
console_line.cpp \
console_stdio.cpp \
crc32.cpp \
crc32_padded.cpp \
events.cpp \
power.cpp \
random.cpp \

View File

@@ -7,7 +7,6 @@ $(call object_for,ion/src/shared/platform_info.cpp): SFLAGS += -DHEADER_SECTION=
src += $(addprefix ion/src/shared/, \
console_line.cpp \
crc32_padded.cpp \
events_keyboard.cpp \
events_modifier.cpp \
)

View File

@@ -6,7 +6,6 @@ src += $(addprefix ion/src/emscripten/, \
src += $(addprefix ion/src/shared/, \
crc32.cpp \
crc32_padded.cpp \
events.cpp \
events_modifier.cpp \
power.cpp \

View File

@@ -1,7 +1,6 @@
# TODO
src += $(addprefix ion/src/shared/, \
crc32.cpp \
crc32_padded.cpp \
events.cpp \
events_keyboard.cpp \
events_modifier.cpp \

View File

@@ -1,28 +0,0 @@
#include <ion.h>
uint32_t Ion::crc32PaddedString(const char * s, int length) {
/* s is a char array. Its length in Bytes is not necessarily a multiple of 4.
* However, crc32 method awaits input in a form of uint32_t table. To limit
* the use of additional memory, we compute 2 crc32:
* - one corresponding to s with a byte length truncated to be a multiple of 4
* - the other corresponds to the remaining chars in s padded with 0 to be 4
* bytes long
* The CRC32 of s is the crc32 of both. */
// CRC32 of the truncated string
uint32_t c[2] = {0, 0};
size_t crc32TruncatedInputSize = (length*sizeof(char))/sizeof(uint32_t);
c[0] = Ion::crc32((const uint32_t *)s, crc32TruncatedInputSize);
/* CRC32 of the tail of the string. We copy the remaining bytes in a uint32_t.
* Because there are less than 3 remaining bytes, we can use strlcpy with a
* size of tailLength + 1, it will be inferior to 4, the size of a uint32_t in
* bytes. */
uint32_t tailName = 0;
size_t offset = (crc32TruncatedInputSize*sizeof(uint32_t))/sizeof(char);
size_t tailLength = length - offset;
strlcpy((char *)&tailName, s+offset, tailLength+1); //+1 because strlcpy assures null termination
c[1] = Ion::crc32(&tailName, 1);
return Ion::crc32((const uint32_t *)c, 2);
}

View File

@@ -8,7 +8,6 @@ src += $(addprefix ion/src/simulator/keyboard/, fltkkbd.cpp)
src += $(addprefix ion/src/shared/, \
crc32.cpp \
crc32_padded.cpp \
console_line.cpp \
console_stdio.cpp \
events_modifier.cpp \