Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: third_party/zlib/adler32.c

Issue 2676493007: NEON implementation for Adler32
Patch Set: Rebased with master Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/zlib/README.chromium ('k') | third_party/zlib/neon_adler32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* adler32.c -- compute the Adler-32 checksum of a data stream 1 /* adler32.c -- compute the Adler-32 checksum of a data stream
2 * Copyright (C) 1995-2011, 2016 Mark Adler 2 * Copyright (C) 1995-2011, 2016 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6 /* @(#) $Id$ */ 6 /* @(#) $Id$ */
7 7
8 #include "zutil.h" 8 #include "zutil.h"
9 #ifdef __ARM_NEON__
10 #include "neon_adler32.h"
11 #endif
9 12
10 local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); 13 local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
11 14
12 #define BASE 65521U /* largest prime smaller than 65536 */ 15 #define BASE 65521U /* largest prime smaller than 65536 */
13 #define NMAX 5552 16 #define NMAX 5552
14 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ 17 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
15 18
16 #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} 19 #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
17 #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); 20 #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
18 #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); 21 #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 # define MOD28(a) a %= BASE 61 # define MOD28(a) a %= BASE
59 # define MOD63(a) a %= BASE 62 # define MOD63(a) a %= BASE
60 #endif 63 #endif
61 64
62 /* ========================================================================= */ 65 /* ========================================================================= */
63 uLong ZEXPORT adler32_z(adler, buf, len) 66 uLong ZEXPORT adler32_z(adler, buf, len)
64 uLong adler; 67 uLong adler;
65 const Bytef *buf; 68 const Bytef *buf;
66 z_size_t len; 69 z_size_t len;
67 { 70 {
71 #ifdef __ARM_NEON__
72 if (len > 31) {
f(malita) 2017/02/21 14:36:37 nit: local code style doesn't seem to require brac
73 return NEON_adler32(adler, buf, len);
f(malita) 2017/02/21 14:36:37 general nit: local code style is 4x-space indentat
74 }
75 #endif
76
68 unsigned long sum2; 77 unsigned long sum2;
69 unsigned n; 78 unsigned n;
70 79
71 /* split Adler-32 into component sums */ 80 /* split Adler-32 into component sums */
72 sum2 = (adler >> 16) & 0xffff; 81 sum2 = (adler >> 16) & 0xffff;
73 adler &= 0xffff; 82 adler &= 0xffff;
74 83
75 /* in case user likes doing a byte at a time, keep it fast */ 84 /* in case user likes doing a byte at a time, keep it fast */
76 if (len == 1) { 85 if (len == 1) {
77 adler += buf[0]; 86 adler += buf[0];
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return adler32_combine_(adler1, adler2, len2); 186 return adler32_combine_(adler1, adler2, len2);
178 } 187 }
179 188
180 uLong ZEXPORT adler32_combine64(adler1, adler2, len2) 189 uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
181 uLong adler1; 190 uLong adler1;
182 uLong adler2; 191 uLong adler2;
183 z_off64_t len2; 192 z_off64_t len2;
184 { 193 {
185 return adler32_combine_(adler1, adler2, len2); 194 return adler32_combine_(adler1, adler2, len2);
186 } 195 }
OLDNEW
« no previous file with comments | « third_party/zlib/README.chromium ('k') | third_party/zlib/neon_adler32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698