Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / avr32 / lib / csum_partial.S
CommitLineData
5f97f7f9
HS
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9 /*
10 * unsigned int csum_partial(const unsigned char *buff,
11 * int len, unsigned int sum)
12 */
13 .text
14 .global csum_partial
15 .type csum_partial,"function"
16 .align 1
17csum_partial:
18 /* checksum complete words, aligned or not */
193: sub r11, 4
20 brlt 5f
214: ld.w r9, r12++
22 add r10, r9
23 acr r10
24 sub r11, 4
25 brge 4b
26
27 /* return if we had a whole number of words */
285: sub r11, -4
29 reteq r10
30
31 /* checksum any remaining bytes at the end */
32 mov r9, 0
33 mov r8, 0
34 cp r11, 2
35 brlt 6f
36 ld.uh r9, r12++
37 sub r11, 2
38 breq 7f
39 lsl r9, 16
406: ld.ub r8, r12++
41 lsl r8, 8
427: or r9, r8
43 add r10, r9
44 acr r10
45
46 retal r10
47 .size csum_partial, . - csum_partial