Function onejoker::cards::hashes::ojh_base13_mp5_low
source · pub fn ojh_base13_mp5_low(cards: &[Card]) -> u32
Expand description
wiki | MPH for ace-to-five low
This branchless assembly version of the base-13 positional rank hash should produce the same value as the above Rust version for 5 cards. Warning: Assumes that it is OK to do a single 64-bit read from the given slice: this will be fine if given a Hand, which has a capacity of 22. But if you create an unaligned slice of 5 cards at the end of a page or something, this may fault. Don’t do that.
use onejoker::prelude::*;
use onejoker::cards::hashes::*;
let d = Deck::new(DeckType::Low);
let h = d.new_hand().init(hand!("7c","6d","4h","3s","2s"));
assert_eq!(182885, ojh_base13_mp5_low(&h[..]));