D - Idea: Bit clear
- chris (15/15) Apr 23 2004 We can already set specific bits with a single operator so i think it wo...
- Juan C (7/9) Apr 23 2004
- chris (7/13) Apr 24 2004 be a
- Vathix (3/6) Apr 22 2004 val &= ~7;
- chris (6/12) Apr 24 2004 what does "~" do? It is listed under "Add Expresions" but i still dont f...
- Lars Ivar Igesund (3/6) Apr 24 2004 Array concatenation (and thus also string concatenation).
- chris (6/11) Apr 24 2004 follow
- Dave Sieber (5/8) Apr 24 2004 When used as a unary operator, '~' is bit-wise NOT, whereas '!' is a una...
- chris (5/11) Apr 24 2004 ah, makes sense now. Cheers.
- Matthew (3/17) Apr 24 2004 ~ is unary bitwise not
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</snip> 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>be aWe can already set specific bits with a single operator so i think it wouldI didnt know about those but from the docs it seems the only functions are for setting / clearing single bits by index. cheers, chrisnice feature to be able to clear them with a single operator. Eg somthing</snip> Oh no, not more operators! Have you read up on Intrinsic Functions?
Apr 24 2004
From: "chris" <news flak.clara.co.uk>We can already set specific bits with a single operator so i think itwould be anice 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>what does "~" do? It is listed under "Add Expresions" but i still dont follow what it does. cheers, chrisWe can already set specific bits with a single operator so i think itwould be anice feature to be able to clear them with a single operator. Eg somthing like...val &= ~7;
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:followwhat does "~" do? It is listed under "Add Expresions" but i still donti am confused.... so what does his example do? Ie... val &= ~7; chriswhat it does.Array concatenation (and thus also string concatenation).
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:ah, makes sense now. Cheers. It is not listed in the "Bitwise Epresions" docs btw. chrisi 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++.
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>what does "~" do? It is listed under "Add Expresions" but i still dont follow what it does. cheers, chrisWe can already set specific bits with a single operator so i think itwould be anice feature to be able to clear them with a single operator. Eg somthing like...val &= ~7;
Apr 24 2004