I'm glad you're aware of it.
Anyhow, the compiler (optimizer and back end) can already deal with bit fields
as it is based on a C compiler. The bitfield ops are replaced by mask and shift
in the cgelem.c code.
dt_t is simply a way to represent static data.
On 1/9/2012 3:35 AM, Sandeep Datta wrote:
Hi Walter,
Thanks for the reply. I am aware of the mixin based solution but the main
motivation for me at this point is getting to know the D compiler well. And
IMHO native support for bitfields will be a welcome new change. I am trying to
write an OS/kernel (https://github.com/SDX2000/Deimos) in D and as far as
machine hugging code is concerned bitfields and unions are a mainstay. The
mixin syntax looks jarring and alien. Please see
https://github.com/SDX2000/Deimos/issues/1 for what I am trying to accomplish.
I am particularly curious about the dt_t data structure you seem to be using
how does this work?
Regards,
Sandeep Datta.
On Mon, Jan 9, 2012 at 5:53 AM, Walter Bright <[email protected]
<mailto:[email protected]>> wrote:
Bit fields are already done in D using a library solution:
http://d.digitalmars.com/2.0/phobos/std_bitmanip.html
On 1/8/2012 7:49 AM, Sandeep Datta wrote:
[Cross post from the D news group]
Hi All,
To gain a better understanding of how the D compiler works I am
trying to implement support for bit fields in structures. I have
modified the parser code to admit the following syntax (for now)...
struct A{
uint:8 a;
uint:5 b;
uint:* unused; //Takes up the remaining space.
//Raise an error when the computed size is zero.
}
You can see my changes here...https://github.com/SDX2000/dmd
I have been trying to work out a strategy for modifying the compiler
code generation for quite some time now but haven't been able to
make much headway in this direction.
I would appreciate any help at this point.
Regards,
Sandeep Datta.
_______________________________________________
dmd-internals mailing list
[email protected] <mailto:[email protected]>
http://lists.puremagic.com/mailman/listinfo/dmd-internals
_______________________________________________
dmd-internals mailing list
[email protected] <mailto:[email protected]>
http://lists.puremagic.com/mailman/listinfo/dmd-internals
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals