C++ implementation: Ensure signness