mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 02:08:30 +00:00
Add spellcheck example
One of the benefits of implementing system call support from scratch is that we're able to have embedded zip filesystem support which trickles into libraries such as stdio, without unportable symbolic interposition. It's also be great if we could say open("gs://bucket/object", O_RDONLY) for seamless GCS, similar to Java NIO, but abstracted by the C library.
This commit is contained in:
parent
0ad0408ac6
commit
b5b60015f5
6 changed files with 180 additions and 1 deletions
|
@ -36,6 +36,7 @@ uint64_t bitreverse64(uint64_t) libcesque pureconst;
|
|||
unsigned long roundup2pow(unsigned long) libcesque pureconst;
|
||||
unsigned long roundup2log(unsigned long) libcesque pureconst;
|
||||
unsigned long rounddown2pow(unsigned long) libcesque pureconst;
|
||||
unsigned long hamming(unsigned long, unsigned long) pureconst;
|
||||
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
│ cosmopolitan § bits » no assembly required ─╬─│┼
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
|
||||
unsigned long(hamming)(unsigned long x, unsigned long y) {
|
||||
/**
|
||||
* Counts number of different bits.
|
||||
*/
|
||||
unsigned long hamming(unsigned long x, unsigned long y) {
|
||||
return popcount(x ^ y);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue