If you look at the Golang source code (copied here: https://gist.github.com/954801 ) you will see that they have something similar. But they use two's complement as well to compare the true or false.
// Package subtle implements functions that are often useful in cryptographic
// code but require careful thought to use correctly.
package subtle