Jump to content

Bitwise operations: Difference between revisions

→‎{{header|R}}: adding .Call
m (→‎{{header|REXX}}: reformatted source, removed a blank line. -- ~~~~)
(→‎{{header|R}}: adding .Call)
Line 1,748:
bitShiftR(35, 1) # 17
# Note that no bit rotation is provided in this package</lang>
 
===Using native function from ''base'' package===
<lang r># As one can see from
getDLLRegisteredRoutines(getLoadedDLLs()$base)
# R knows functions bitwiseAnd, bitwiseOr, bitwiseXor and bitwiseNot.
# Here is how to call them (see ?.Call for the calling mechanism):
 
.Call("bitwiseOr", as.integer(12), as.integer(10))
.Call("bitwiseXor", as.integer(12), as.integer(10))
.Call("bitwiseAnd", as.integer(12), as.integer(10))
.Call("bitwiseNot", as.integer(12))
 
# It would be easy to embed these calls in R functions, for better readability
# Also, it's possible to call these functions on integer vectors:
 
.Call("bitwiseOr", c(5L, 2L), c(3L, 8L))</lang>
 
=={{header|Retro}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.