fix type inference

* fix type inference

* make checks inclusive for negative values of integers

* move to newer version of ubuntu

* fix iterator macros

* fix iterator macros
This commit is contained in:
Zoltán Vörös 2025-06-06 21:29:41 +02:00 committed by GitHub
parent 1398a8606f
commit 844f6e5e1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 18 deletions

View file

@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-24.04
- macOS-latest
dims: [1, 2, 3, 4]
runs-on: ${{ matrix.os }}
@ -61,7 +61,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-24.04
- macOS-latest
dims: [1, 2, 3, 4]
runs-on: ${{ matrix.os }}

View file

@ -1482,7 +1482,7 @@ ndarray_obj_t *ndarray_from_mp_obj(mp_obj_t obj, uint8_t other_type) {
if(mp_obj_is_int(obj)) {
int32_t ivalue = mp_obj_get_int(obj);
if((ivalue < -32767) || (ivalue > 32767)) {
if((ivalue < -32768) || (ivalue > 65535)) {
// the integer value clearly does not fit the ulab integer types, so move on to float
ndarray = ndarray_new_linear_array(1, NDARRAY_FLOAT);
mp_float_t *array = (mp_float_t *)ndarray->array;
@ -1490,7 +1490,7 @@ ndarray_obj_t *ndarray_from_mp_obj(mp_obj_t obj, uint8_t other_type) {
} else {
uint8_t dtype;
if(ivalue < 0) {
if(ivalue > -128) {
if(ivalue >= -128) {
dtype = NDARRAY_INT8;
} else {
dtype = NDARRAY_INT16;

View file

@ -759,8 +759,8 @@ ndarray_obj_t *ndarray_from_mp_obj(mp_obj_t , uint8_t );
} while(_k_ < (_source_)->shape[ULAB_MAX_DIMS - 2]);\
(_source_array_) -= (_source_)->strides[ULAB_MAX_DIMS - 2] * (_source_)->shape[ULAB_MAX_DIMS - 2];\
(_source_array_) += (_source_)->strides[ULAB_MAX_DIMS - 3];\
j++;\
} while(j < (_source_)->shape[ULAB_MAX_DIMS - 3]);
_j_++;\
} while(_j_ < (_source_)->shape[ULAB_MAX_DIMS - 3]);
#endif /* ULAB_MAX_DIMS == 3 */

View file

@ -33,7 +33,7 @@
#include "user/user.h"
#include "utils/utils.h"
#define ULAB_VERSION 6.7.6
#define ULAB_VERSION 6.7.7
#define xstr(s) str(s)
#define str(s) #s

View file

@ -1,3 +1,9 @@
Fri, 06 Jun 2025
version 6.7.7
fix ndarray type inference for micropython objects
Thu, 29 May 2025
version 6.7.6