If it's hard to make a perfect hash function, and assuming you don't need
modification after initialisation, you could use struct {keys []uint32;
vals []uint64}, sort the keys and their associated values, then binary
search. By storing keys and values in different slices, you save 25% space
because the keys can be packed together.On 24 July 2017 at 18:03, Jan Mercl <[email protected]> wrote: > On Mon, Jul 24, 2017 at 5:32 PM il <[email protected]> wrote: > > > Can you help me best solution? > > Create a perfect hash function in 28 bits. Use a [1<<28]T array for the > map values. > > > -- > > -j > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
