kaesereibe Posted July 25, 2014 Share Posted July 25, 2014 (edited) Dec 2 Bin (Decimal to Binary)This shows an another alternate function for dec to binFunc Dec2Bin($D) Return (BitShift($D, 1) ? Dec2Bin(BitShift($D, 1)) : "") & BitAnd($D, 1) EndFunc ;==> Dec2Bin() AutoIt v3.3.12.0 MsgBox(0, "Dec2Bin", Dec2Bin(1337) & " | " & Dec2Bin(15)) ; ==> 10100111001 | 1111or (thx to AspirinJunkie) Func Dec2Bin2($D) Return $D ? Dec2Bin2(BitShift($D, 1)) & BitAnd($D, 1) : "" EndFunc ;==> Dec2Bin() AutoIt v3.3.12.0 MsgBox(0, "Dec2Bin", Dec2Bin2(1337) & " | " & Dec2Bin2(15)) ; ==> 10100111001 | 1111Bin 2 Dec (Binary to Decimal)This shows an another alternate function for bin to decFunc Bin2Dec($B) Return BitOr((StringLen($B) > 1 ? BitShift(Bin2Dec(StringTrimRight($B, 1)), -1) : 0), StringRight($B, 1)) EndFunc ;==> Bin2Dec() AutoIt v3.3.12.0 MsgBox(0, "Bin2Dec", Bin2Dec(10100111001) & " | " & Bin2Dec(1111)) ; ==> 1337 | 15 Edited July 25, 2014 by kaesereibe BIN 2 DEC | ConvertTemp | DEC 2 BIN | GetWeekday | HEX 2 RGB | INT 2 HEX | QueryPerformance Link to comment Share on other sites More sharing options...
kaesereibe Posted July 25, 2014 Author Share Posted July 25, 2014 Bin2Dec added BIN 2 DEC | ConvertTemp | DEC 2 BIN | GetWeekday | HEX 2 RGB | INT 2 HEX | QueryPerformance Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now