and then modify most of it locally to work on other 64-bit archs so just merge this tiny diff into patch-layer3_c