| 308 | #define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes))) |
| 309 | |
| 310 | static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){ |
| 311 | int i, off; |
| 312 | uint32_t c; |
| 313 | const uint32_t* buf; |
| 314 | uint32_t* obuf = (uint32_t*) out; |
| 315 | /* FIXME: 64 bit platforms would be able to do 64 bits at a time. |
| 316 | * I'm too lazy though, should be something like |
| 317 | * for(i=0 ; i<bitamount/64 ; i++) |
| 318 | * (int64_t)out[i] = 0x37c511f237c511f2^be2me_64(int64_t)in[i]); |
| 319 | * Buffer alignment needs to be checked. */ |
| 320 | |
| 321 | off = (intptr_t)inbuffer & 3; |
| 322 | buf = (const uint32_t*) (inbuffer - off); |
| 323 | c = be2me_32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8)))); |
| 324 | bytes += 3 + off; |
| 325 | for (i = 0; i < bytes/4; i++) |
| 326 | obuf[i] = c ^ buf[i]; |
| 327 | |
| 328 | return off; |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * Cook uninit |
no outgoing calls
no test coverage detected