(x - a) % b + a
Can this be simplified so a occurs just once?
>>53705525
/homework/ is that way >>>/sci/
function rot13(text) {
return text.replace(/[A-Z]/ig, function(ch) {
var base = ch > "Z" ? "a".charCodeAt(0) : "A".charCodeAt(0);
return String.fromCharCode((ch.charCodeAt(0) - base + 13) % 26 + base);
});
}
I want to condense the code so base only occurs once. Is it possible?
>>53705525
not without redefining x as a multiple of a
int a = a();
>>53705525
who cares. The compiler is smarter at optimization than you are.
>>53705843
ok i was just wondering