BeRTOS
|
00001 00047 #ifndef ALGO_ROTATING_H 00048 #define ALGO_ROTATING_H 00049 00050 #include <cfg/compiler.h> 00051 00052 typedef uint16_t rotating_t; 00053 00054 00058 INLINE void rotating_init(rotating_t *rot) 00059 { 00060 *rot = 0; 00061 } 00062 00066 INLINE void rotating_update1(uint8_t c, rotating_t *rot) 00067 { 00068 *rot = (*rot << 4) ^ (*rot >> 12) ^ c; 00069 } 00070 00074 INLINE void rotating_update(const void *_buf, size_t len, rotating_t *rot) 00075 { 00076 const uint8_t *buf = (const uint8_t *)_buf; 00077 00078 while (len--) 00079 rotating_update1(*buf++, rot); 00080 } 00081 00082 00083 #endif // ALGO_ROTATING_H