Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/8f9af83967b2d38f6363c726339d5a21 to your computer and use it in GitHub Desktop.
Save trycf/8f9af83967b2d38f6363c726339d5a21 to your computer and use it in GitHub Desktop.
TryCF Gist
<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