// Found this C code online.
int isEven(int num) { return !(num & 1); } // found this in std.functional.unaryFun alias isEven = unaryFun!("(a & 1) == 0"); assert(isEven(2) && !isEven(1)); If interested just in speed, is either one faster?
WhatMeWorry via Digitalmars-d-learn Wed, 26 Apr 2023 16:07:01 -0700
// Found this C code online.
int isEven(int num) { return !(num & 1); } // found this in std.functional.unaryFun alias isEven = unaryFun!("(a & 1) == 0"); assert(isEven(2) && !isEven(1)); If interested just in speed, is either one faster?