Skip to content

Instantly share code, notes, and snippets.

@rgchris
Created January 25, 2017 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgchris/b34b21c42f70587d9c9fb8b012d6a894 to your computer and use it in GitHub Desktop.
Save rgchris/b34b21c42f70587d9c9fb8b012d6a894 to your computer and use it in GitHub Desktop.
Convert an Integer to Binary
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