Created
January 25, 2017 04:59
-
-
Save rgchris/b34b21c42f70587d9c9fb8b012d6a894 to your computer and use it in GitHub Desktop.
Convert an Integer to Binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
Title: "Integer to Binary" | |
Date: 24-Jan-2017 | |
] | |
method-1: func [ | |
int [integer!] | |
][ | |
debase/base to-hex int 16 | |
] | |
method-2: func [ | |
int [integer!] | |
][ | |
to binary! reduce [ | |
255 and shift int 24 | |
255 and shift int 16 | |
255 and shift int 8 | |
255 and int | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment