diff options
author | Kyle Repinski <repinski23@gmail.com> | 2015-12-02 12:32:39 -0600 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-01-17 22:41:00 +0100 |
commit | 153b50ec9714ff4ba6ce083ca0d49fd31658ce15 (patch) | |
tree | 8dab0e630a39552385d42a266ba39dfdaf837752 /libsensors/mlsdk/mlutils/checksum.c | |
parent | b8515d8e0376e300ed17598f0288fad0e6ae0d89 (diff) | |
download | device_samsung_tuna-153b50ec9714ff4ba6ce083ca0d49fd31658ce15.zip device_samsung_tuna-153b50ec9714ff4ba6ce083ca0d49fd31658ce15.tar.gz device_samsung_tuna-153b50ec9714ff4ba6ce083ca0d49fd31658ce15.tar.bz2 |
sensors: Merge invensense HAL into main tuna HAL.
Since these are both in our device tree now, there's no need to
have them be separated. This saves about 14KB of space as well.
Change-Id: Ibfcd7da4b30bb261586ecd9373e6fd4a343e0e06
Diffstat (limited to 'libsensors/mlsdk/mlutils/checksum.c')
-rw-r--r-- | libsensors/mlsdk/mlutils/checksum.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libsensors/mlsdk/mlutils/checksum.c b/libsensors/mlsdk/mlutils/checksum.c new file mode 100644 index 0000000..a97477d --- /dev/null +++ b/libsensors/mlsdk/mlutils/checksum.c @@ -0,0 +1,16 @@ +#include "mltypes.h" + +/** bernstein hash, from public domain source */ + +uint32_t inv_checksum(unsigned char *str, int len) +{ + uint32_t hash = 5381; + int i, c; + + for (i = 0; i < len; i++) { + c = *(str + i); + hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + } + + return hash; +} |