File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1887,4 +1887,10 @@ int print_sha1_ellipsis(void);
1887
1887
/* Return 1 if the file is empty or does not exists, 0 otherwise. */
1888
1888
int is_empty_or_missing_file (const char * filename );
1889
1889
1890
+ /*
1891
+ * Extended crc32 with 64 bit address range
1892
+ * On Windows, uInt/uLong are only 32 bits.
1893
+ */
1894
+ extern uLong xcrc32 (uLong crc , const unsigned char * buf , size_t bytes );
1895
+
1890
1896
#endif /* CACHE_H */
Original file line number Diff line number Diff line change @@ -703,3 +703,19 @@ int is_empty_or_missing_file(const char *filename)
703
703
704
704
return !st .st_size ;
705
705
}
706
+
707
+ uLong xcrc32 (uLong crc , const unsigned char * buf , size_t bytes )
708
+ {
709
+ size_t bytes_rem , off ;
710
+ bytes_rem = bytes ;
711
+ off = 0 ;
712
+ while (bytes_rem ) {
713
+ int crc_bytes = maximum_signed_value_of_type (int );
714
+ if (crc_bytes > bytes_rem )
715
+ crc_bytes = bytes_rem ;
716
+ crc = crc32 (crc , buf + off , crc_bytes );
717
+ off += crc_bytes ;
718
+ bytes_rem -= crc_bytes ;
719
+ }
720
+ return crc ;
721
+ }
You can’t perform that action at this time.
0 commit comments