Skip to content

Commit 7691da3

Browse files
committed
py/binary: Remove mp_binary_set_val_array_from_int().
This is a long-standing C function in binary.h, but it's no longer called from inside MicroPython. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 6146494 commit 7691da3

File tree

3 files changed

+0
-64
lines changed

3 files changed

+0
-64
lines changed

ports/unix/coverage.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -627,19 +627,6 @@ static mp_obj_t extra_coverage(void) {
627627
mp_printf(&mp_plat_print, "%s\n", buf2);
628628
}
629629

630-
// binary
631-
{
632-
mp_printf(&mp_plat_print, "# binary\n");
633-
634-
// call function with float and double typecodes
635-
float far[1];
636-
double dar[1];
637-
mp_binary_set_val_array_from_int('f', far, 0, 123);
638-
mp_printf(&mp_plat_print, "%.0f\n", (double)far[0]);
639-
mp_binary_set_val_array_from_int('d', dar, 0, 456);
640-
mp_printf(&mp_plat_print, "%.0lf\n", dar[0]);
641-
}
642-
643630
// VM
644631
{
645632
mp_printf(&mp_plat_print, "# VM\n");

py/binary.c

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -491,53 +491,3 @@ void mp_binary_set_val_array(char typecode, void *p, size_t index, mp_obj_t val_
491491
}
492492
}
493493
}
494-
495-
void mp_binary_set_val_array_from_int(char typecode, void *p, size_t index, mp_int_t val) {
496-
switch (typecode) {
497-
case 'b':
498-
((signed char *)p)[index] = val;
499-
break;
500-
case BYTEARRAY_TYPECODE:
501-
case 'B':
502-
((unsigned char *)p)[index] = val;
503-
break;
504-
case 'h':
505-
((short *)p)[index] = val;
506-
break;
507-
case 'H':
508-
((unsigned short *)p)[index] = val;
509-
break;
510-
case 'i':
511-
((int *)p)[index] = val;
512-
break;
513-
case 'I':
514-
((unsigned int *)p)[index] = val;
515-
break;
516-
case 'l':
517-
((long *)p)[index] = val;
518-
break;
519-
case 'L':
520-
((unsigned long *)p)[index] = val;
521-
break;
522-
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
523-
case 'q':
524-
((long long *)p)[index] = val;
525-
break;
526-
case 'Q':
527-
((unsigned long long *)p)[index] = val;
528-
break;
529-
#endif
530-
#if MICROPY_PY_BUILTINS_FLOAT
531-
case 'f':
532-
((float *)p)[index] = (float)val;
533-
break;
534-
case 'd':
535-
((double *)p)[index] = (double)val;
536-
break;
537-
#endif
538-
// Extension to CPython: array of pointers
539-
case 'P':
540-
((void **)p)[index] = (void *)(uintptr_t)val;
541-
break;
542-
}
543-
}

py/binary.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
size_t mp_binary_get_size(char struct_type, char val_type, size_t *palign);
3838
mp_obj_t mp_binary_get_val_array(char typecode, void *p, size_t index);
3939
void mp_binary_set_val_array(char typecode, void *p, size_t index, mp_obj_t val_in);
40-
void mp_binary_set_val_array_from_int(char typecode, void *p, size_t index, mp_int_t val);
4140
mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte *p_base, byte **ptr);
4241
void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte *p_base, byte **ptr);
4342
long long mp_binary_get_int(size_t size, bool is_signed, bool big_endian, const byte *src);

0 commit comments

Comments
 (0)