Merge branch 'ss/exc-flag-is-a-collection-of-bits'
[git] / compat / sha1-chunked.c
1 #include "cache.h"
2
3 int git_SHA1_Update_Chunked(platform_SHA_CTX *c, const void *data, size_t len)
4 {
5         size_t nr;
6         size_t total = 0;
7         const char *cdata = (const char*)data;
8
9         while (len) {
10                 nr = len;
11                 if (nr > SHA1_MAX_BLOCK_SIZE)
12                         nr = SHA1_MAX_BLOCK_SIZE;
13                 platform_SHA1_Update(c, cdata, nr);
14                 total += nr;
15                 cdata += nr;
16                 len -= nr;
17         }
18         return total;
19 }