<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    I'm glad you're aware of it.<br>
    <br>
    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.<br>
    <br>
    dt_t is simply a way to represent static data.<br>
    <br>
    On 1/9/2012 3:35 AM, Sandeep Datta wrote:
    <blockquote
cite="mid:CABMMkDOCDvqQ1xNfaOPWJ7NbbJ2dOhWG2iSSdQq6iDaZO50cvg@mail.gmail.com"
      type="cite">Hi Walter,
      <div><br>
      </div>
      <div>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 (<a
          moz-do-not-send="true"
          href="https://github.com/SDX2000/Deimos">https://github.com/SDX2000/Deimos</a>) 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 <a moz-do-not-send="true"
          href="https://github.com/SDX2000/Deimos/issues/1">https://github.com/SDX2000/Deimos/issues/1</a> for
        what I am trying to accomplish.</div>
      <div><br>
      </div>
      <div>I am particularly curious about the dt_t data structure you
        seem to be using how does this work? </div>
      <div><br>
      </div>
      <div>Regards,</div>
      <div>Sandeep Datta.</div>
      <div><br>
        <div class="gmail_quote">On Mon, Jan 9, 2012 at 5:53 AM, Walter
          Bright <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:walter@digitalmars.com" target="_blank">walter@digitalmars.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <div bgcolor="#ffffff" text="#000000"> Bit fields are
              already done in D using a library solution:<br>
              <br>
              <a moz-do-not-send="true"
                href="http://d.digitalmars.com/2.0/phobos/std_bitmanip.html"
                target="_blank">http://d.digitalmars.com/2.0/phobos/std_bitmanip.html</a>
              <div>
                <div><br>
                  <br>
                  On 1/8/2012 7:49 AM, Sandeep Datta wrote: </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div>
                    <div>[Cross post from the D news group]</div>
                    <div><br>
                    </div>
                    <div>Hi All,</div>
                    <div><br>
                    </div>
                    <div>To gain a better understanding of how the D
                      compiler works I am</div>
                    <div>trying to implement support for bit fields in
                      structures. I have</div>
                    <div>modified the parser code to admit the following
                      syntax (for now)...</div>
                    <div><br>
                    </div>
                    <div>struct A{</div>
                    <div>    uint:8 a;</div>
                    <div>    uint:5 b;</div>
                    <div>    uint:* unused; //Takes up the remaining
                      space.</div>
                    <div>    //Raise an error when the computed size is
                      zero.</div>
                    <div>}</div>
                    <div><br>
                    </div>
                    <div>You can see my changes here...<a
                        moz-do-not-send="true"
                        href="https://github.com/SDX2000/dmd"
                        target="_blank">https://github.com/SDX2000/dmd</a></div>
                    <div><br>
                    </div>
                    <div>I have been trying to work out a strategy for
                      modifying the compiler</div>
                    <div>code generation for quite some time now but
                      haven't been able to</div>
                    <div>make much headway in this direction.</div>
                    <div><br>
                    </div>
                    <div> I would appreciate any help at this point.</div>
                    <div><br>
                    </div>
                    <div>Regards,</div>
                    <div>Sandeep Datta.</div>
                    <div><br>
                    </div>
                  </div>
                </div>
                <pre><fieldset></fieldset>
_______________________________________________
dmd-internals mailing list
<a moz-do-not-send="true" href="mailto:dmd-internals@puremagic.com" target="_blank">dmd-internals@puremagic.com</a>
<a moz-do-not-send="true" href="http://lists.puremagic.com/mailman/listinfo/dmd-internals" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a></pre>
              </blockquote>
            </div>
            <br>
            _______________________________________________<br>
            dmd-internals mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:dmd-internals@puremagic.com" target="_blank">dmd-internals@puremagic.com</a><br>
            <a moz-do-not-send="true"
              href="http://lists.puremagic.com/mailman/listinfo/dmd-internals"
              target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
dmd-internals mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dmd-internals@puremagic.com">dmd-internals@puremagic.com</a>
<a class="moz-txt-link-freetext" href="http://lists.puremagic.com/mailman/listinfo/dmd-internals">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a></pre>
    </blockquote>
  </body>
</html>