1. Adding C_ULONGLONG
- Posted by ghaberek (admin) Feb 13, 2015
- 1594 views
I've come across several C functions that return uint64_t, so it seems we need to add C_ULONGLONG. We have C_LONGLONG declared for signed int64_t types, but not unsigned.
If these changes look good, I can commit them to the default branch. I don't commit code very often (if ever) so I wanted to double-check before proceeding.
http://openeuphoria.org/pastey/265.wc
-Greg
2. Re: Adding C_ULONGLONG
- Posted by mattlewis (admin) Feb 14, 2015
- 1756 views
I've come across several C functions that return uint64_t, so it seems we need to add C_ULONGLONG. We have C_LONGLONG declared for signed int64_t types, but not unsigned.
If these changes look good, I can commit them to the default branch. I don't commit code very often (if ever) so I wanted to double-check before proceeding.
It looks reasonable to me. Please add a test for this, preferably in t_callc.e.
Matt
3. Re: Adding C_ULONGLONG
- Posted by ghaberek (admin) Feb 14, 2015
- 1526 views
It looks reasonable to me. Please add a test for this, preferably in t_callc.e.
Matt
I had to adjust the checks for valid param and return types in be_machine.c as well.
Tests added and passed correctly. Pushed changes back up.
-Greg
4. Re: Adding C_ULONGLONG
- Posted by rkdavis Feb 14, 2015
- 1535 views
just a quick query.
is line 1518 of be_callc.c correct? I think it might supposed to be
if( uint64_t_result <= (unsigned long long int)MAXINT uint64_t_result >= (unsigned long long int)0 ){
instead of
if( uint64_t_result <= (unsigned long long int)MAXINT int64_t_result >= (unsigned long long int)0 ){
5. Re: Adding C_ULONGLONG
- Posted by ghaberek (admin) Feb 14, 2015
- 1505 views
just a quick query.
is line 1518 of be_callc.c correct? I think it might supposed to be
if( uint64_t_result <= (unsigned long long int)MAXINT && uint64_t_result >= (unsigned long long int)0 ){
instead of
if( uint64_t_result <= (unsigned long long int)MAXINT && int64_t_result >= (unsigned long long int)0 ){
Good catch. What's interesting is that int64_t_result isn't even be defined within that if block, so the compiler should have caught that and failed to the build. ("A good workman never blames his tools.") I will get it fixed right quick.
-Greg
6. Re: Adding C_ULONGLONG
- Posted by rkdavis Feb 14, 2015
- 1484 views
It was my compiler (gcc (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2 ) that caught it :)
7. Re: Adding C_ULONGLONG
- Posted by ghaberek (admin) Feb 14, 2015
- 1496 views
It was my compiler (gcc (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2) that caught it :)
Interesting. I was dusting off my Raspberry Pi to do some test builds myself.
I just pushed a few more changes...
- we don't need to check for >= 0 because the value is unsigned
- I caused a test to fail by not casting to uint64_t before returning a NewDouble.
-Greg