repo.or.cz
/
omfsprogs.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fix incorrect swap in mkomfs
[omfsprogs.git]
/
libomfs
/
crc.c
blob
65c196f285a1fdcdf050c74b59d7570bcb8f333f
1
2
#include
"config.h"
3
#include
"crc.h"
4
5
/* crc-ccitt but with msb first */
6
u16
crc_ccitt_msb
(
u16 crc
,
unsigned char
*
buf
,
int
count
)
7
{
8
int
i
,
j
;
9
for
(
i
=
0
;
i
<
count
;
i
++)
10
{
11
crc
^=
buf
[
i
] <<
8
;
12
for
(
j
=
0
;
j
<
8
;
j
++)
13
crc
= (
crc
<<
1
) ^ ((
crc
&
0x8000
) ?
POLY
:
0
);
14
}
15
return
crc
;
16
}