Re: setting <input> checked
"Kiss Gabor (Bitman)" <kissg-8/[email protected]> Mon, 8 Dec 2014 07:59:34 +0100 (CET)
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <[email protected]> |
> Yea, I had already tried the single & and it does not work.
Unfortunately there are no arithmetic and bitwise operators in TT.
But in theory the problem can be solved with comparisons only. :-)
Let's assume that flags can be at most 255. Then this logical expression
is equal to flags&0x08:
flags >= 248 ||
flags < 240 && flags >= 232 ||
flags < 224 && flags >= 216 ||
flags < 208 && flags >= 200 ||
flags < 192 && flags >= 184 ||
flags < 176 && flags >= 168 ||
flags < 160 && flags >= 152 ||
flags < 144 && flags >= 136 ||
flags < 128 && flags >= 120 ||
flags < 112 && flags >= 104 ||
flags < 96 && flags >= 88 ||
flags < 80 && flags >= 72 ||
flags < 64 && flags >= 56 ||
flags < 48 && flags >= 40 ||
flags < 32 && flags >= 24 ||
flags < 16 && flags >= 8
Gabor