espressif / esp-dsp

DSP library for ESP-IDF
Apache License 2.0
442 stars 87 forks source link

Fix pointer formatting causing -fpermissive error (DSP-77) #42

Closed Barabas5532 closed 1 year ago

Barabas5532 commented 2 years ago

This error is printed when compiling for Linux with gcc (GCC) 11.2.0:

esp-dsp/modules/matrix/mat/mat.cpp:625:61: warning: cast from ‘float*’ to ‘uint32_t’ {aka ‘unsigned int’} loses precision [-fpermissive]
  625 |     ESP_LOGD("Mat", "allocate(%i) = 0x%8.8x", this->length, (uint32_t)this->data);
      |                                                             ^~~~~~~~~~~~~~~~~~~~

The declaration of data is float *data, so %p should be used when printing it.

dmitry1945 commented 1 year ago

@Barabas5532 the changes you've made now in master. Next time I will add your commit directly to the master, but now it was hard because we did some chnges before, and was to complicated to rebase your commit.

Barabas5532 commented 1 year ago

https://github.com/espressif/esp-dsp/commit/597fd7814defecbbd6cdeda3d30a5e1dc138252a