<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=296280423-05072007><FONT color=#0000ff>I totally agree and 
would always do it like that; I was just responding directly to the question 
asked.</FONT></SPAN></DIV>
<DIV><SPAN class=296280423-05072007><FONT 
color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=296280423-05072007><FONT color=#0000ff>BTW: shouldn't you be 
going to bed on your side of the world?</FONT></SPAN></DIV>
<DIV><SPAN class=296280423-05072007><FONT 
color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=296280423-05072007><FONT 
color=#0000ff>Albert.</FONT></SPAN></DIV>
<DIV><SPAN class=296280423-05072007></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> John Baraclough 
  [mailto:j_baraclough@zetnet.co.uk]<BR><B>Sent:</B> Friday, 6 July 2007 9:00 
  a.m.<BR><B>To:</B> Discussion list for ICCAVR and ICCtiny Users. You do NOT 
  need tosubscribe to icc-announce if you are a member of 
  this.<BR><B>Subject:</B> RE: [Icc-avr] check for adequately nr. of 
  bits<BR><BR></FONT></DIV>You could indeed, but it would be very unwise. Single 
  bit flags should <B>always</B> be stored in 8-bit variables, otherwise there 
  is a very large overhead in setting, clearing or testing any flag. This is the 
  way I define flag macros for fastest execution:<BR><BR><FONT 
  face="Courier New, Courier">#include &lt;macros.h&gt;<BR><BR>#define 
  SCR_BIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  0<BR>#define 
  RUN_BIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  1<BR>#define 
  SEN_BIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  2<BR>#define 
  CHA_BIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  3<BR>#define 
  UPD_BIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  4<BR><BR></FONT><FONT face="Courier New, Courier" color=#008000>// Flow 
  control flags.<BR></FONT><FONT face="Courier New, Courier">#define 
  TEST_SCREEN_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  gucFlags&amp;BIT(SCR)<BR>#define 
  SET_SCREEN_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  gucFlags|=BIT(SCR)<BR>#define 
  CLEAR_SCREEN_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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 
  gucFlags&amp;BIT(CHA)<BR>#define 
  SET_CHANGE_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  gucFlags|=BIT(CHA)<BR>#define 
  CLEAR_CHANGE_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  gucFlags&amp;=~BIT(CHA)<BR><BR>#define 
  TEST_UPDATE_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  gucFlags&amp;BIT(UPD)<BR>#define 
  SET_UPDATE_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  gucFlags|=BIT(UPD)<BR>#define 
  CLEAR_UPDATE_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  gucFlags&amp;=~BIT(UPD)<BR><BR></FONT>Whichever way you choose, stay with 
  8-bit variable as the holders for flags.<BR><BR>HTH<BR><BR>All the best for 
  now,<BR>John<BR><BR>At 21:13 05/07/2007, you wrote:<BR>
  <BLOCKQUOTE class=cite cite="" type="cite"><FONT color=#0000ff>couldn't you 
    simply say<BR></FONT>&nbsp;<BR><FONT color=#0000ff>#if </FONT><FONT 
    size=2>NROFFLAGS&lt;17<BR><BR>Unsigned int 
    uiFlags;<BR><BR>#else<BR><BR>Unsigned long 
    uiFlags;<BR>#endif<BR></FONT>&nbsp;<BR><FONT 
    size=2>Albert<BR></FONT>&nbsp;<BR>&nbsp;<BR>
    <DL>
      <DD><FONT face=Tahoma size=2>-----Original Message-----<BR>
      <DD>From:</B> Jaspers, Ton [<A href="mailto:t.jaspers@cpseurope.com" 
      eudora="autourl"> mailto:t.jaspers@cpseurope.com</A>]<BR>
      <DD>Sent:</B> Friday, 6 July 2007 12:45 a.m.<BR>
      <DD>To:</B> Discussion list for ICCAVR and ICCtiny Users. You do NOT need 
      to subscribeto icc-announce if you are a member of this.<BR>
      <DD>Subject:</B> RE: [Icc-avr] check for adequately nr. of 
      bits<BR><BR></FONT>
      <DD>I don't think it is a linker issue. It is a coding issue. You could 
      try to use teh pre-processor with something like this:<BR>
      <DD><BR>&nbsp;
      <DD><FONT size=2>&nbsp;&nbsp;&nbsp; #include &lt;limits.h&gt;<BR></FONT>
      <DD><BR>&nbsp;
      <DD><FONT size=2>&nbsp;&nbsp;&nbsp; #define NROFFLAGS 17<BR></FONT>
      <DD><BR>&nbsp;
      <DD><FONT size=2>&nbsp;&nbsp;&nbsp; #if&nbsp; (1&lt;&lt;(NROFFLAGS-1)) 
      &gt;&nbsp; UINT_MAX<BR></FONT>
      <DD>&nbsp;&nbsp;&nbsp;&nbsp; ERROR “VALUE TO SMALL”&nbsp;&nbsp;&nbsp; <BR>
      <DD><FONT size=2>&nbsp;&nbsp;&nbsp; #endif<BR></FONT><BR>
      <DD><FONT size=2>Mind you, I have not tried it.<BR></FONT>
      <DD><BR>&nbsp;
      <DD><FONT size=2>Cheers,<BR>
      <DD>Ton<BR></FONT>
      <DD><BR>
      <DL>
        <HR>

        <DD><FONT face=Tahoma size=2>From:</B> icc-avr-bounces@imagecraft.com 
        [<A href="mailto:icc-avr-bounces@imagecraft.com" eudora="autourl"> 
        mailto:icc-avr-bounces@imagecraft.com</A>] On Behalf Of </B>Steven 
        Lose<BR>
        <DD>Sent:</B> donderdag 5 juli 2007 12:59<BR>
        <DD>To:</B> Discussion list for ICCAVR and ICCtiny Users. You do NOT 
        need tosubscribeto icc-announce if you are a member of this.<BR>
        <DD>Subject:</B> [Icc-avr] check for adequately nr. of 
        bits<BR></FONT><BR>
        <DD><FONT size=2><A></A>Hi.<BR></FONT><BR>
        <DD><FONT size=2><BR></FONT><BR>&nbsp;
        <DD><FONT size=2>I want to make the linker check that a variable is 
        defined big enough, but don’t know how.<BR></FONT><BR>
        <DD><FONT size=2><BR></FONT><BR>&nbsp;
        <DD><FONT size=2>Basically I need something that tells me how many bits 
        there is in a variable so I can check it up against a defined 
        value.<BR></FONT><BR>
        <DD><FONT size=2><BR></FONT><BR>&nbsp;
        <DD><FONT size=2>#define NROFFLAGS 17<BR></FONT><BR>
        <DD><FONT size=2><BR></FONT><BR>&nbsp;
        <DD><FONT size=2>Unsigned int uiFlags;<BR></FONT><BR>
        <DD><FONT size=2><BR></FONT><BR>&nbsp;
        <DD><FONT size=2>#if NROFFLAGS &gt; NROFBITS(uiFlags)<BR></FONT><BR>
        <DD><FONT size=2>&nbsp;ERROR “VALUE TO SMALL”<BR></FONT><BR>
        <DD><FONT size=2>#endif<BR></FONT><BR>
        <DD><FONT size=2><BR></FONT><BR>&nbsp;
        <DD><FONT size=2>Is it possible to do so? (if it had been in code I 
        would just use (sizeof(uiFlags)*8) )<BR></FONT><BR>
        <DD><FONT size=2>And if yes, what is the right way to do 
        it?<BR></FONT><BR>
        <DD><FONT size=2><BR></FONT><BR>&nbsp;
        <DD><FONT face="Times New Roman, Times">Med venlig hilsen / Best regards 
        / mit freundlichen Grüßen<BR></FONT><BR>
        <DD><FONT face="Times New Roman, Times" color=#000080>EC POWER 
        A/S<BR></B></FONT><BR>
        <DD><FONT face="Times New Roman, Times" color=#000080>Steven 
        Lose<BR></B></FONT><BR>
        <DD><FONT face="Times New Roman, Times">Software Ingeniør<BR></FONT><BR>
        <DD><FONT face="Times New Roman, Times">Tlf.: +45 
87434100<BR></FONT><BR>
        <DD><FONT face="Times New Roman, Times">Direkte tlf. +45 
        58286608<BR></FONT><BR>
        <DD><FONT face="Times New Roman, Times">Email: <A 
        href="blocked::mailto:bsl@ecpower.dk">sl@ecpower.dk</A><BR></FONT><BR>
        <DD><FONT face="Times New Roman, Times"><A href="http://www.ecpower.dk/" 
        eudora="autourl">www.ecpower.dk</A><BR></FONT><BR>
        <DD><FONT 
      face="Times New Roman, Times"><BR></FONT><BR>&nbsp;</DD></DL></DD></DL>_______________________________________________<BR>Icc-avr 
    mailing list<BR>Icc-avr@imagecraft.com<BR><A 
    href="http://dragonsgate.net/mailman/listinfo/icc-avr" 
    eudora="autourl">http://dragonsgate.net/mailman/listinfo/icc-avr</A></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>