<div dir="ltr"><div>Any ideas if is this possible?<br><br></div>Thanks for your help!<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 23, 2014 at 5:15 PM, Fano il primo <span dir="ltr"><<a href="mailto:fanoilprimo@gmail.com" target="_blank">fanoilprimo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Good Morning,<br>
<br>
it is a lot of time that I'm lurking this mailing list and the LLVM<br>
documentation and when I've seen that the assembler bitcode uses this<br>
special int types a question arises in my mind, why they have not<br>
added them as C/C++ extensions?<br>
<br>
The bool type in C is an hack being defined as a unsigned char or an<br>
int, but it should be naturally an int1 in LLVM, right? (I don't know<br>
if there is code that depends to the fact that it's size is 4 to work<br>
it would be wrong code).<br>
<br>
This types could be useful to replace the bitfield struct with a more<br>
natural construct too:<br>
<br>
typedef struct printer_status_t {<br>
      int1 pre_paper_out; // 1/true if the paper is in pre-out, 0 /<br>
false if paper present<br>
      int1 paper_out;  // 1/true if paper is out, 0/ false if paper is not ended<br>
      int1 drawer_opened; // 1/true if drawer is opened, 0/false if<br>
drawer is closed<br>
      int1 printer_offline; // 1/ true if printer is offline, 0/false if online<br>
      int1  filler[4]; // or int4 filler, I imagine not to be possible<br>
to have them all for C<br>
} printer_status;<br>
<br>
Imagine the possibility for an Object Language as C++ you could<br>
replace the external libraries classes a BigNumber creating simply a<br>
class Number (an integer with size 1 to 2^80 bit) "allocating" space<br>
on demand for it so that:<br>
<br>
Number n1 = 1; // only a bit is needed<br>
Number n2 = 3 // only 2 bits are needed<br>
Number n3 = 99000 // Only 5 bits are needed<br>
Number n4 = 1'000'000'000'000'000'000'000'000'000 // log2(n4) bitsare needed<br>
<br>
I imagine this would be valid only for the bitcode itself and when it<br>
need to be compiled is probable that padding should be needed (or some<br>
strange Kludge to represent more that an int64 on a X86 on 32 mode).<br>
<br>
A character expressed as UTF32 could be expressed as an Int21, if one wants!<br>
<br>
I have intention this summer to play with Kaledoscopie and to try to<br>
derive a toy Object Language from it, it would be my first compiler<br>
:-)<br>
The "Number" class would be one of the first I'll implement (after<br>
Object and... null) but I needed to known if it is possible first...<br>
<br>
Thanks for your attention!<br>
</blockquote></div><br></div>