Would this be an appropriate way to implement an lookup table in Go? Are there any better ways? I'd like this to work if the entries happened to be nonconsecutive.
func LookupRpMax(val uint8) float64 {
rpMaxRegisters := map[uint8]float64 {
0x00 : 3926991,
0x01 : 3141593,
0x02 : 2243995,
0x03 : 1745329,
0x04 : 1308997,
0x05 : 981748,
0x06 : 747998,
0x07 : 581776,
0x08 : 436332,
0x09 : 349066,
0x0A : 249333,
0x0B : 193926,
0x0C : 145444,
0x0D : 109083,
0x0E : 83111,
0x0F : 64642,
0x10 : 48481,
0x11 : 38785,
0x12 : 27704,
0x13 : 21547,
0x14 : 16160,
0x15 : 12120,
0x16 : 9235,
0x17 : 7182,
0x18 : 5387,
0x19 : 4309,
0x1A : 3078,
0x1B : 2394,
0x1C : 1796,
0x1D : 1347,
0x1E : 1026,
0x1F : 798,
}
return rpMaxRegisters[val];
}