File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1884,4 +1884,10 @@ int print_sha1_ellipsis(void);
18841884/* Return 1 if the file is empty or does not exists, 0 otherwise. */
18851885int is_empty_or_missing_file (const char * filename );
18861886
1887+ /*
1888+ * Extended crc32 with 64 bit address range
1889+ * On Windows, uInt/uLong are only 32 bits.
1890+ */
1891+ extern uLong xcrc32 (uLong crc , const unsigned char * buf , size_t bytes );
1892+
18871893#endif /* CACHE_H */
Original file line number Diff line number Diff line change @@ -703,3 +703,17 @@ int is_empty_or_missing_file(const char *filename)
703703
704704 return !st .st_size ;
705705}
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 > (size_t )INTMAX_MAX ) {
713+ int crc_bytes = (bytes_rem > (size_t )INTMAX_MAX ) ? (size_t )INTMAX_MAX : bytes_rem ;
714+ crc = crc32 (crc , buf + off , crc_bytes );
715+ off += crc_bytes ;
716+ bytes_rem -= crc_bytes ;
717+ }
718+ return crc ;
719+ }
You can’t perform that action at this time.
0 commit comments