This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Compile list of tokens based on deletions, and respecting max edit distance | |
| // Original implementation would concatenate left/right string segments using memcpy() etc, but that didn't seem right | |
| // The idea is, to instead partition S into 1+ segments and build hash from them, no need for memory copies etc. | |
| // This is almost x8 times faster compared to that - but it's still in the 10s of microseconds range. | |
| // | |
| // ( for a 31 characters long string, with max edit distance = 2, it takes 24 microseconds, including the cost for computing the FNV rolling hash ) | |
| #include <switch.h> | |
| #include <switch_print.h> | |
| #include <ansifmt.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static uint8_t DigitsCount(uint64_t v) | |
| { | |
| for (uint8_t res{1}; ;res+=4, v/=10000U) | |
| { | |
| if (likely(v < 10)) return res; | |
| if (likely(v < 100)) return res + 1; | |
| if (likely(v < 1000)) return res + 2; | |
| if (likely(v < 10000)) return res + 3; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://gist.github.com/markpapadakis/8dba5c480c13b12a056e (example) | |
| // https://medium.com/@markpapadakis/high-performance-services-using-coroutines-ac8e9f54d727 | |
| #include <switch.h> | |
| #include <switch_print.h> | |
| #include <switch_ll.h> | |
| #include <switch_bitops.h> | |
| #include <md5.h> | |
| #include <text.h> | |
| #include <network.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef MINIPOOL_H | |
| #define MINIPOOL_H | |
| #include <cassert> | |
| #include <cstddef> | |
| #include <memory> | |
| #include <new> | |
| #include <utility> | |
| /* |
OlderNewer