#include "llvm/ADT/APInt.h" #includeint main() { llvm::APInt val(32, "4294967295", 10); // 32-bit unsigned int with maximum value int signedVal = val.getSExtValue(); // converting unsigned to signed int std::cout << signedVal << std::endl; // The output is -1 return 0; }
#include "llvm/ADT/APInt.h" #includeOutput: 9223372036854775807 Package Library: The getSExtValue function is a member of the APInt class which is part of the LLVM library. Therefore, the package library for this function is LLVM.int main() { llvm::APInt val(64, "9223372036854775807", 10); // 64-bit unsigned int with maximum value long long signedVal = val.getSExtValue(); // converting unsigned to signed long long std::cout << signedVal << std::endl; // The output is 9223372036854775807 return 0; }