General computer science topics applicable to any subdomain.
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
| use std::cell::Cell; | |
| /// A thunk used for lazy generation and caching of values | |
| struct Thunk<T: Copy> { | |
| /// Cached value stored in the thunk | |
| value: Cell<Option<T>>, | |
| /// Generator function to generate a missing value | |
| generator: fn() -> T | |
| } |
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
| /// AVX implementation of the Harley-Seal algorithm for counting the number of bits in a bitset | |
| /// | |
| /// # Safety | |
| /// Assumes that the input is `BITSET_SIZE_IN_WORDS` in length | |
| pub unsafe fn cardinality(bitset: &[u64]) -> usize { | |
| debug_assert!(bitset.len() == BITSET_SIZE_IN_WORDS); | |
| let d = bitset.as_ptr() as *const Register; |
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
| #!/bin/bash | |
| # --- Packages --- | |
| # NOTE: I've noticed some issues where installs may fail if rapidly queued, to prevent this | |
| # an artificial delay is inserted since this seems to make the behavior much more | |
| # predictable | |
| # Some operations seem to fail if time is not given for the system to do some kind of | |
| # processing under the hood, so we insert artificial delays to help the process along |
OlderNewer