Cello icon indicating copy to clipboard operation
Cello copied to clipboard

Configuration with 32-bit Int and Float types.

Open katyo opened this issue 9 years ago • 2 comments

Many ARM and MIPS-based 32-bit embedded platforms works natively faster with single precision floats and int32_t and much slower with 64-bit variants. I assume that it must be configurable depending of platform.

katyo avatar Sep 17 '15 05:09 katyo

I simply replaced all 64-bit types to 32-bit using sed:

sed -i -e 's/int64_t/int32_t/g' -e 's/double/float/g' include/*.h src/*.c

Because I use Cello with OpenWRT (mips 24k), it works fine for me.

But more pretty solution is something like this:

#if CELLO_32BIT
typedef int32_t int_t;
typedef uint32_t uint_t;
typedef float float_t;
#else
typedef int64_t int_t;
typedef uint64_t uint_t;
typedef double float_t;
#endif

Platform dependent types: size_t and ssize_t is also useful for integer values.

katyo avatar Sep 17 '15 07:09 katyo

Hey,

This is a good idea. I'll try to implement some 32-bit/64-bit compile time variable like the one you showed. I'm not keen on using the native types int and unsigned int etc because this creates code that behaves differently on different platforms but certainly a compile time flag to force 64 bit or 32 bit seems pretty good and should be useful for embedded platforms.

  • Dan

orangeduck avatar Sep 20 '15 14:09 orangeduck