Smaller crc for the boot loader.

Save 7k of text space by using simpler crc32 for standalone case. we
don't need all that fancy optimization in the boot loader, so use a
simplified version of the CRC function. We could save more by doing it
one bit at a time rather than 32, but this is the biggest savings at
the smallest performance hit.

With LUA and verfied exec, gptboot, gptzfsboot and friends are pushing
the ~530k limit and every little bit helps.

Reviewed By: allanjude
Differential Revision: https://reviews.freebsd.org/D24225
This commit is contained in:
Warner Losh 2020-09-01 04:37:55 +00:00
parent 3ae3a7a7c0
commit cffca129a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365022

View file

@ -227,6 +227,7 @@ singletable_crc32c(uint32_t crc, const void *buf, size_t size)
return crc;
}
#ifndef _STANDALONE
/*
* Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
@ -788,3 +789,10 @@ calculate_crc32c(uint32_t crc32c,
return (multitable_crc32c(crc32c, buffer, length));
}
}
#else
uint32_t
calculate_crc32c(uint32_t crc32c, const unsigned char *buffer, unsigned int length)
{
return (singletable_crc32c(crc32c, buffer, length));
}
#endif