digitalmars.D - Bit type?
- Dan <murpsoft hotmail.com> Nov 23 2007
- "Stewart Gordon" <smjg_1998 yahoo.com> Nov 24 2007
- BCS <ao pathlink.com> Nov 24 2007
I thought I recalled D having a "bit[]" type with the restriction that you could only use bit[n*8]? I'm asking because I've been developing an interest in DNA. I had thought it would be an amazing project to produce an open source DNA format. Raw DNA uses two bits, but you could probably need another 2 per base pair for expression. From there, you have raw DNA. You want to build slices, as slices get copied off to make siRNA and mRNA and such. So mapping out which parts of the DNA are used to make copies of what tends to be useful. D just seems to fit together quite well - but I want an easy 4-bit type to work with. Who likes the idea?
Nov 23 2007
"Dan" <murpsoft hotmail.com> wrote in message news:fi7r8q$l05$1 digitalmars.com...I thought I recalled D having a "bit[]" type with the restriction that you could only use bit[n*8]?
There was once a bit type, but it never had such a restriction. Walter removed it, I think because it was found too complicated and bug-prone to implement. Or something like that. Meanwhile, Phobos has std.bitarray. I also have a bit array implementation capable of arbitrary slicing: http://pr.stewartsplace.org.uk/d/sutil/ <snip>D just seems to fit together quite well - but I want an easy 4-bit type to work with. Who likes the idea?
4-bit type? I guess some of the bit array code could be modified to give nibble arrays, if that's what you mean.... Stewart. -- My e-mail address is valid but not my primary mailbox. Please keep replies on the 'group where everybody may benefit.
Nov 24 2007
Reply to Stewart,"Dan" <murpsoft hotmail.com> wrote in message news:fi7r8q$l05$1 digitalmars.com...I thought I recalled D having a "bit[]" type with the restriction that you could only use bit[n*8]?
Walter removed it, I think because it was found too complicated and bug-prone to implement. Or something like that.
I think it was dropped because there was no way to get uniform slice semantics bit[100] bits; auto bits[20..25]; For that to even be doable it needs a copy that junks reference semantics, or needs to play games with pointers in ways that restrict sliced bit arrays to only 1/8th of the address space (low 3 bits of pointer are used for position in byte and byte location is got by bit shifting, but now the high order bits need to be implicit :P )
Nov 24 2007








BCS <ao pathlink.com>