@@ -274,23 +274,30 @@ mp_obj_t ndarray_binary_modulo(ndarray_obj_t *lhs, ndarray_obj_t *rhs,
274
274
MODULO_FLOAT_LOOP (results , mp_float_t , uint8_t , mp_float_t , larray , lstrides , rarray , rstrides );
275
275
}
276
276
} else if (lhs -> dtype == NDARRAY_INT8 ) {
277
- if (rhs -> dtype == NDARRAY_INT8 ) {
277
+ if (rhs -> dtype == NDARRAY_UINT8 ) {
278
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_INT16 );
279
+ BINARY_LOOP (results , int16_t , int8_t , uint8_t , larray , lstrides , rarray , rstrides , %);
280
+ } else if (rhs -> dtype == NDARRAY_INT8 ) {
278
281
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_INT8 );
279
282
BINARY_LOOP (results , int8_t , int8_t , int8_t , larray , lstrides , rarray , rstrides , %);
280
283
} else if (rhs -> dtype == NDARRAY_UINT16 ) {
281
284
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_INT16 );
282
- BINARY_LOOP (results , int16_t , int8_t , uint16_t , larray , lstrides , rarray , rstrides , %);
285
+ BINARY_LOOP (results , int16_t , int8_t , int16_t , larray , lstrides , rarray , rstrides , %);
283
286
} else if (rhs -> dtype == NDARRAY_INT16 ) {
284
287
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_INT16 );
285
288
BINARY_LOOP (results , int16_t , int8_t , int16_t , larray , lstrides , rarray , rstrides , %);
286
289
} else if (rhs -> dtype == NDARRAY_FLOAT ) {
287
290
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
288
291
MODULO_FLOAT_LOOP (results , mp_float_t , int8_t , mp_float_t , larray , lstrides , rarray , rstrides );
289
- } else {
290
- return ndarray_binary_op (MP_BINARY_OP_ADD , MP_OBJ_FROM_PTR (rhs ), MP_OBJ_FROM_PTR (lhs ));
291
292
}
292
293
} else if (lhs -> dtype == NDARRAY_UINT16 ) {
293
- if (rhs -> dtype == NDARRAY_UINT16 ) {
294
+ if (rhs -> dtype == NDARRAY_UINT8 ) {
295
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_UINT8 );
296
+ BINARY_LOOP (results , uint16_t , uint16_t , uint8_t , larray , lstrides , rarray , rstrides , %);
297
+ } else if (rhs -> dtype == NDARRAY_INT8 ) {
298
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
299
+ BINARY_LOOP (results , mp_float_t , uint16_t , int8_t , larray , lstrides , rarray , rstrides , %);
300
+ } else if (rhs -> dtype == NDARRAY_UINT16 ) {
294
301
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_UINT16 );
295
302
BINARY_LOOP (results , uint16_t , uint16_t , uint16_t , larray , lstrides , rarray , rstrides , %);
296
303
} else if (rhs -> dtype == NDARRAY_INT16 ) {
@@ -299,25 +306,40 @@ mp_obj_t ndarray_binary_modulo(ndarray_obj_t *lhs, ndarray_obj_t *rhs,
299
306
} else if (rhs -> dtype == NDARRAY_FLOAT ) {
300
307
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
301
308
MODULO_FLOAT_LOOP (results , mp_float_t , uint16_t , mp_float_t , larray , lstrides , rarray , rstrides );
302
- } else {
303
- return ndarray_binary_op (MP_BINARY_OP_ADD , MP_OBJ_FROM_PTR (rhs ), MP_OBJ_FROM_PTR (lhs ));
304
309
}
305
310
} else if (lhs -> dtype == NDARRAY_INT16 ) {
306
- if (rhs -> dtype == NDARRAY_INT16 ) {
311
+ if (rhs -> dtype == NDARRAY_UINT8 ) {
312
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_INT16 );
313
+ BINARY_LOOP (results , int16_t , int16_t , uint8_t , larray , lstrides , rarray , rstrides , %);
314
+ } else if (rhs -> dtype == NDARRAY_INT8 ) {
315
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_INT16 );
316
+ BINARY_LOOP (results , int16_t , int16_t , int8_t , larray , lstrides , rarray , rstrides , %);
317
+ } else if (rhs -> dtype == NDARRAY_UINT16 ) {
318
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
319
+ BINARY_LOOP (results , mp_float_t , int16_t , uint16_t , larray , lstrides , rarray , rstrides , %);
320
+ } else if (rhs -> dtype == NDARRAY_INT16 ) {
307
321
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_INT16 );
308
322
BINARY_LOOP (results , int16_t , int16_t , int16_t , larray , lstrides , rarray , rstrides , %);
309
323
} else if (rhs -> dtype == NDARRAY_FLOAT ) {
310
324
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
311
325
MODULO_FLOAT_LOOP (results , mp_float_t , int16_t , mp_float_t , larray , lstrides , rarray , rstrides );
312
- } else {
313
- return ndarray_binary_op (MP_BINARY_OP_ADD , MP_OBJ_FROM_PTR (rhs ), MP_OBJ_FROM_PTR (lhs ));
314
326
}
315
327
} else if (lhs -> dtype == NDARRAY_FLOAT ) {
316
- if (rhs -> dtype == NDARRAY_FLOAT ) {
328
+ if (rhs -> dtype == NDARRAY_UINT8 ) {
329
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
330
+ MODULO_FLOAT_LOOP (results , mp_float_t , mp_float_t , uint8_t , larray , lstrides , rarray , rstrides );
331
+ } else if (rhs -> dtype == NDARRAY_INT8 ) {
332
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
333
+ MODULO_FLOAT_LOOP (results , mp_float_t , mp_float_t , int8_t , larray , lstrides , rarray , rstrides );
334
+ } else if (rhs -> dtype == NDARRAY_UINT16 ) {
335
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
336
+ MODULO_FLOAT_LOOP (results , mp_float_t , mp_float_t , uint16_t , larray , lstrides , rarray , rstrides );
337
+ } else if (rhs -> dtype == NDARRAY_INT16 ) {
338
+ results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
339
+ MODULO_FLOAT_LOOP (results , mp_float_t , mp_float_t , int16_t , larray , lstrides , rarray , rstrides );
340
+ } else if (rhs -> dtype == NDARRAY_FLOAT ) {
317
341
results = ndarray_new_dense_ndarray (ndim , shape , NDARRAY_FLOAT );
318
342
MODULO_FLOAT_LOOP (results , mp_float_t , mp_float_t , mp_float_t , larray , lstrides , rarray , rstrides );
319
- } else {
320
- return ndarray_binary_op (MP_BINARY_OP_ADD , MP_OBJ_FROM_PTR (rhs ), MP_OBJ_FROM_PTR (lhs ));
321
343
}
322
344
}
323
345
0 commit comments