Created
February 23, 2024 11:31
-
-
Save trycf/8f9af83967b2d38f6363c726339d5a21 to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or 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
<cfscript> | |
function bitAndCustom(num1, num2) { | |
// Convert the input BigIntegers to Java BigInteger objects | |
var javaNum1 = createObject("java", "java.math.BigInteger").init(num1); | |
var javaNum2 = createObject("java", "java.math.BigInteger").init(num2); | |
// Perform the bitwise AND operation | |
var result = javaNum1.and(javaNum2); | |
// Convert the result back to a ColdFusion integer | |
var op = 2147483648; | |
var op1 = op.intValue() | |
writeOutput(op1) | |
return result.longValue(); | |
} | |
// Example usage | |
//writeOutput(bitAndCustom(2147483648, 2147483648) eq 2147483648) | |
//writeOutput(2147483648.intValue()) | |
//writeOutput(BitAnd((2147483648), 2147483648.intValue()) eq 2147483648) | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment