I stole the ifdef from bytestring, which has used this function forever.