dec_head.c 550 B

1234567891011121314151617181920212223242526272829
  1. int ret = 0;
  2. const uint8_t *c = (const uint8_t *)src;
  3. uint8_t *o = (uint8_t *)out;
  4. uint8_t q;
  5. // Use local temporaries to avoid cache thrashing:
  6. size_t outl = 0;
  7. struct plain64_base64_state st;
  8. st.eof = state->eof;
  9. st.bytes = state->bytes;
  10. st.carry = state->carry;
  11. // If we previously saw an EOF or an invalid character, bail out:
  12. if (st.eof) {
  13. *outlen = 0;
  14. return 0;
  15. }
  16. // Turn four 6-bit numbers into three bytes:
  17. // out[0] = 11111122
  18. // out[1] = 22223333
  19. // out[2] = 33444444
  20. // Duff's device again:
  21. switch (st.bytes)
  22. {
  23. for (;;)
  24. {
  25. case 0: