in reply to Re^2: Converting negative number to binary with specific widthin thread Converting negative number to binary with specific width
Make sure you look at AnomalousMonk's version of the code.