D - Idea: Bit clear
- "chris" <news flak.clara.co.uk> Apr 23 2004
- Juan C <Juan_member pathlink.com> Apr 23 2004
- "chris" <news flak.clara.co.uk> Apr 24 2004
- "Vathix" <vathix dprogramming.com> Apr 22 2004
- "chris" <news flak.clara.co.uk> Apr 24 2004
- Lars Ivar Igesund <larsivar igesund.net> Apr 24 2004
- "chris" <news flak.clara.co.uk> Apr 24 2004
- Dave Sieber <dsieber spamnot.sbcglobal.net> Apr 24 2004
- "chris" <news flak.clara.co.uk> Apr 24 2004
- "Matthew" <matthew.hat stlsoft.dot.org> Apr 24 2004
We can already set specific bits with a single operator so i think it would be a nice feature to be able to clear them with a single operator. Eg somthing like... val = val !! 7; would be much clearer than either of... val = (val | 7) ^ 7; val = val & (!7); I am not even sure !7 actualy be converted to the correct bit mask anyway? Is the compiler smart enough to make the bitmask the same width as the variable? At least it does not seem obvious what width the !7 should be. With a bit clear operator it is explicit what width the bitmask should be. And it may be of benefit for processors (like the StrongArm) that have a bit clear instruction. Mabey even x86 will some day. cheers, chris
Apr 23 2004
<snip>We can already set specific bits with a single operator so i think it would be a nice feature to be able to clear them with a single operator. Eg somthing
Oh no, not more operators! Have you read up on Intrinsic Functions? Were it not for those I'd suggest adding member functions int.BitTest(int), int.BitSet(int), and int.BitClear(int) -- but they would make it difficult to mimic x = y op z
Apr 23 2004
"Juan C" <Juan_member pathlink.com> wrote in message news:c6cgog$2qlh$1 digitaldaemon.com...<snip>We can already set specific bits with a single operator so i think it would
nice feature to be able to clear them with a single operator. Eg somthing
Oh no, not more operators! Have you read up on Intrinsic Functions?
I didnt know about those but from the docs it seems the only functions are for setting / clearing single bits by index. cheers, chris
Apr 24 2004
From: "chris" <news flak.clara.co.uk>We can already set specific bits with a single operator so i think it
nice feature to be able to clear them with a single operator. Eg somthing like...
val &= ~7;
Apr 22 2004
"Vathix" <vathix dprogramming.com> wrote in message news:c6cgp3$2qlt$1 digitaldaemon.com...From: "chris" <news flak.clara.co.uk>We can already set specific bits with a single operator so i think it
nice feature to be able to clear them with a single operator. Eg somthing like...
val &= ~7;
what does "~" do? It is listed under "Add Expresions" but i still dont follow what it does. cheers, chris
Apr 24 2004
chris wrote:what does "~" do? It is listed under "Add Expresions" but i still dont follow what it does.
Array concatenation (and thus also string concatenation). Lars Ivar
Apr 24 2004
"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:c6dm4f$281$1 digitaldaemon.com...chris wrote:what does "~" do? It is listed under "Add Expresions" but i still dont
what it does.
Array concatenation (and thus also string concatenation).
i am confused.... so what does his example do? Ie... val &= ~7; chris
Apr 24 2004
"chris" <news flak.clara.co.uk> wrote:i am confused.... so what does his example do? Ie... val &= ~7;
When used as a unary operator, '~' is bit-wise NOT, whereas '!' is a unary logical NOT. Same as in C and C++. -- dave
Apr 24 2004
"Dave Sieber" <dsieber spamnot.sbcglobal.net> wrote in message news:Xns94D53C42924D8dsiebersbc 63.105.9.61..."chris" <news flak.clara.co.uk> wrote:i am confused.... so what does his example do? Ie... val &= ~7;
When used as a unary operator, '~' is bit-wise NOT, whereas '!' is a unary logical NOT. Same as in C and C++.
ah, makes sense now. Cheers. It is not listed in the "Bitwise Epresions" docs btw. chris
Apr 24 2004
~ is unary bitwise not "chris" <news flak.clara.co.uk> wrote in message news:c6dltq$254$1 digitaldaemon.com..."Vathix" <vathix dprogramming.com> wrote in message news:c6cgp3$2qlt$1 digitaldaemon.com...From: "chris" <news flak.clara.co.uk>We can already set specific bits with a single operator so i think it
nice feature to be able to clear them with a single operator. Eg somthing like...
val &= ~7;
what does "~" do? It is listed under "Add Expresions" but i still dont follow what it does. cheers, chris
Apr 24 2004









"chris" <news flak.clara.co.uk> 