From 9a13aedd4ef04711fc5139c86025272e9648cc4c Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sun, 23 Nov 2014 19:28:40 +0100 Subject: double indirect block support to ELF and check sum calc --- userspace/checker.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 userspace/checker.c (limited to 'userspace/checker.c') diff --git a/userspace/checker.c b/userspace/checker.c new file mode 100644 index 0000000..e5352f6 --- /dev/null +++ b/userspace/checker.c @@ -0,0 +1,19 @@ +#include + +int main() + +{ +FILE *fp; /* The file handle for input data */ +fp=stdin; +int ch; /* Each character read. */ +int checksum = 0; /* The checksum mod 2^16. */ +int count=0; + +while ((ch = getc(fp)) != EOF) { + checksum = (checksum >> 1) + ((checksum & 1) << 15); + checksum +=(int) ch; + checksum &= 0xffff; /* Keep it within bounds. */ + count++; +} +printf("checksum : 0x%08X for %i bytes\n",checksum,count); +} -- cgit v1.2.3