Bleh, so the unsigned LEB128 encode/decode work fine, bulletproof even. but for some reason the signed equivalents are just broken.
Signed encode can't encode non-negative value, and the decode always decodes and non-negative. I'm going mad here.
I'm just going to chalk this up to my own incompetence at everything and call it a night.
Welcome to your niu world ! We are a cute and loving international community Ｏ(≧▽≦)Ｏ !