Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
413 B

  1. #include "scan.h"
  2. size_t scan_varint(const char* in,size_t len, unsigned long long* n) {
  3. size_t i;
  4. unsigned long long l;
  5. if (len==0) return 0;
  6. l=0;
  7. for (l=0, i=0; i<len; ++i) {
  8. l+=(in[i]&0x7f) << (i*7);
  9. if (!(in[i]&0x80)) {
  10. *n=l;
  11. return i+1;
  12. }
  13. }
  14. return 0;
  15. }
  16. size_t scan_pb_type0_int(const char* dest,size_t len,unsigned long long* l) __attribute__((alias("scan_varint")));