diff options
author | Nick Brassel <nick@tzarc.org> | 2022-06-27 07:18:21 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 07:18:21 +1000 |
commit | 01ecf332ff9f0c8f61e493cdca116f58d80bb5fb (patch) | |
tree | 92fc03cbdeb2bf963574bfeed29276e164ca7561 /lib/fnv/have_ulong64.c | |
parent | 0d013a21e1347fc38e742b2bd876329e86c153a9 (diff) | |
download | qmk_firmware-01ecf332ff9f0c8f61e493cdca116f58d80bb5fb.tar.gz qmk_firmware-01ecf332ff9f0c8f61e493cdca116f58d80bb5fb.zip |
Generic wear-leveling algorithm (#16996)
* Initial import of wear-leveling algorithm.
* Alignment.
* Docs tweaks.
* Lock/unlock.
* Update quantum/wear_leveling/wear_leveling_internal.h
Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
* More tests, fix issue with consolidation when unlocked.
* More tests.
* Review comments.
* Add plumbing for FNV1a.
* Another test checking that checksum mismatch clears the cache.
* Check that the write log still gets played back.
Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
Diffstat (limited to 'lib/fnv/have_ulong64.c')
-rw-r--r-- | lib/fnv/have_ulong64.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/fnv/have_ulong64.c b/lib/fnv/have_ulong64.c new file mode 100644 index 0000000000..5c06262388 --- /dev/null +++ b/lib/fnv/have_ulong64.c @@ -0,0 +1,58 @@ +/* + * have_ulong64 - Determine if we have a 64 bit unsigned long long + * + * usage: + * have_ulong64 > longlong.h + * + * Not all systems have a 'long long type' so this may not compile on + * your system. + * + * This prog outputs the define: + * + * HAVE_64BIT_LONG_LONG + * defined ==> we have a 64 bit unsigned long long + * undefined ==> we must simulate a 64 bit unsigned long long + */ +/* + * + * Please do not copyright this code. This code is in the public domain. + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * By: + * chongo <Landon Curt Noll> /\oo/\ + * http://www.isthe.com/chongo/ + * + * Share and Enjoy! :-) + */ + +/* + * have the compiler try its hand with unsigned and signed long longs + */ +#if ! defined(NO64BIT_LONG_LONG) +unsigned long long val = 1099511628211ULL; +#endif /* NO64BIT_LONG_LONG */ + +int +main(void) +{ + /* + * ensure that the length of long long val is what we expect + */ +#if defined(NO64BIT_LONG_LONG) + printf("#undef HAVE_64BIT_LONG_LONG\t/* no */\n"); +#else /* NO64BIT_LONG_LONG */ + if (val == 1099511628211ULL && sizeof(val) == 8) { + printf("#define HAVE_64BIT_LONG_LONG\t/* yes */\n"); + } +#endif /* NO64BIT_LONG_LONG */ + + /* exit(0); */ + return 0; +} |