Re: Embedding machine code
- Posted by "Juergen Luethje" <j.lue at gmx.de> Feb 26, 2004
- 588 views
Derek wrote: > I wanted to use Juergen's 'bit.e' library for doing 32-bit manipulations > because he uses machine code to achieve get over Euphoria's lack of > 32-bit integers. Thanks.> However, the code doesn't work because it has lines like this ... > > > SHIFT_LEFT = define_c_func("", SHL_SPACE, {C_INT, C_INT}, C_INT) > > but that gives the error message ... > > c:\euphoria\include\dll.e:50 in function define_c_func() > type_check failure, lib is {} As others already wrote, 'bit.e' only works with Eu 2.4 or later, sorry.
> Any ideas about how I should actually call these machine code routines? Tommy Carlier wrote some sample code, that does something similar, using the old way to define and call ASM functions: http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=C&fromYear=8&toMonth=C&toYear=8&postedBy=Tommy+Carlier&keywords=rotate_left > What I really need is when I have an atom that exceeds a 32-bit format I > want to chop off the excess bits and only keep the low 32 bits. Tommy uses poke4() to put the parameters to the machine code. Does poke4() automatically only keep the low 32 bits? I don't know. If you want, I can make a different version of 'bit.e', that also runs on older Euphoria versions. Do you need all 9 functions in 'bit.e', or only some of them? Regards, Juergen