Advertisement
Guest User

Untitled

a guest
May 18th, 2020
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <stdint.h>
  2. #include <stdlib.h>
  3.  
  4. static uint8_t lfsr(uint8_t v) {
  5.   const uint8_t bit = v>>7;
  6.   v <<= 1;
  7.   v ^= (-bit) & 0xA6;
  8.   return v;
  9. }
  10.  
  11. void vec(size_t n, uint8_t* out, uint8_t const* in)
  12. {
  13.   for (size_t i = 0; i < n; ++i) {
  14.     out[i] = lfsr(in[i]);
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement