I haven't tried but maybe htod can help, try copypasting the code to a header file and run it through htod. There's also some flags htod can take to simplify the output, iirc. But maybe htod isn't clever enough to do bitfields..
On 12/7/10, Stanislav Blinov <bli...@loniir.ru> wrote: > 07.12.2010 11:58, Jonathan M Davis пишет: >> Okay. I'm trying to get some C code to be properly callable from some D >> code, >> which naturally involves some extern(C) blocks. One of the types that I >> have to >> deal with looks something like this: >> >> typedef struct >> { >> unsigned i:1; >> } my_struct; >> >> I have no idea how to do such a bitfield in D. Does a >> std.bitmanip.bitfield work? >> I wouldn't have thought so, but I don't know. What would be the proper way >> to >> create a properly compatible struct in D? >> >> - Jonathan M Davis >> > I'm under the impression that > > struct my_struct > { > mixin(bitfields!( > uint, "i", 1, > uint, "", 31)); > } > > should do the trick. >