TIL: If you bit shift too far in C/C++it's undefined behavior. Been doing C++ since Borland C++ for DOS and never knew. Wow! Example Code (wow!): https://onlinegdb.com/r1TRJLJPG Docs 1: https://wiki.sei.cmu.edu/confluence/display/c/INT34-C.+Do+not+shift+an+expression+by+a+negative+number+of+bits+or+by+greater+than+or+equal+to+the+number+of+bits+that+exist+in+the+operand … Docs 2: https://msdn.microsoft.com/en-us/library/336xbhcz.aspx …
There are plenty of things that are technically undefined but which only the most asinine compiler authors would enforce. Right-shifting signed values is one that MAME relies on all *over* the place.