MICROPY_OBJ_REPR_C causes 'identifier "mp_float_t" is undefined'

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
igorgatis
Posts: 21
Joined: Thu Nov 19, 2015 1:10 pm

MICROPY_OBJ_REPR_C causes 'identifier "mp_float_t" is undefined'

Post by igorgatis » Mon Nov 30, 2015 4:22 pm

I'm trying to use MICROPY_OBJ_REPR_C but it fails with:

Code: Select all

 identifier "mp_float_t" is undefined
Should it include mpconfig.h?

In time: if I'm using a 32-bit (big endian) platform, what representation model should I use? A, B, C or D? And why?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: MICROPY_OBJ_REPR_C causes 'identifier "mp_float_t" is undefined'

Post by dhylands » Mon Nov 30, 2015 5:17 pm

Here's my interpretation of the various MICROPY_OBJ_REPR's (I was surpised that there weren't any summary comments in the obj.h file)

A - 31 bit small int and qstrs can be packed into an mp_obj_t

B - I think that this was intended for 16-bit PIC port. It still packs in a small int and a qstr, but it needs 2 bits for both, and the qstr and small int both occupy odd pointer values.

C - 31 bit small int, qstr, and a 30-bit float are packed into an mp_obj_t. This would allow reduced memory consumption for floats, and would allow floats to be used from within ISRs. I wonder if a variant that allowed 31-bit floats and 30-bit small ints might be more appropriate?

D - Increases the mp_obj_t to 64-bits, but allows almost a 64-bit float to be represented in an mp_obj_t. I saw a comment somewhere that had the bit layouts, bit can't seem to find it any more.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: MICROPY_OBJ_REPR_C causes 'identifier "mp_float_t" is undefined'

Post by Damien » Tue Dec 01, 2015 9:46 am

The comments and bit representations for the different object models are in py/mpconfig.h. To use repr C you need to also #define MICROPY_FLOAT_IMPL MICROPY_FLOAT_IMPL_FLOAT.

Post Reply