Skip to content

Instantly share code, notes, and snippets.

@MrPeanutButta
Last active February 21, 2021 14:38
Show Gist options
  • Save MrPeanutButta/10073969 to your computer and use it in GitHub Desktop.
Save MrPeanutButta/10073969 to your computer and use it in GitHub Desktop.
// http://www.sigcomm.org/sites/default/files/ccr/papers/2012/October/2378956-2378961.pdf
int dir_24_8_lookup(uint32_t dst) {
int nh = tbl_0_23[dst >> 8]; // index in the next hop table
if (nh & 0x8000)nh = tbl_24_31[((nh & 0x7fff) << 8) | (dst & 0xff)];
return nh;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment