Speed is irrelevant if the result is incorrect.
So fully agree!
What are the units for offset? If it is bytes, your code is
incorrect because it computes the wrong address.
p is unsigned int *. The units of the offest are in unsigned int.
Is the value to be extracted truly an unsigned int? Is the
value of p[0] correctly aligned for an unsigned int?
yes to all
What is the type of p? Since you don't cast the expression
*(p+1), I expect it is something similar to int*.
mmm I dont cast it but the result is and unsigned int*. Sorry, I
forgot
to say the pointer type
(
Are you absolutely positive that the pointer value in p[0] and
the offset in p[1] have the same size?
Absolutely. In fact the invention works, there is not better
demostration
Does you implementation guarantee that converting an int (*p)
to a pointer will have the
Yeah, that is precisely the trick hehe
Just out of curiosity, how did you end up with such a sorry state?
Implemeting an Abstract Machine (for Prolog, nor for Java) that
takes only 2 pages (of 4Kb) of memory and goes between 8 and 100
times faster (in the set of benchmarks I have, but we will see
in the rest of programs) than conventional abstract machines
In AM all memory is plain and the program executed has no
types at all (they are created on run-time). Even internal
structs of the AM are not too typed. You only know that in a
certain address of memory there is another address of memory
that cointains the data you want... etc etc, and you only know
that in run-time, that is because an "int" can be a pointer,
a number, a char...
Converting an int to a pointer is guaranteed non-portable.
I dont guess any reason for that... but I believe you. Thanks
for the info, I hope not to run into a wall too hard when
porting it to other architectures.
emmm, is this your quote? Else I did not get the meaning
of this sentence.