Skip to content

Commit 45695d9

Browse files
committed
Fix after rebase
1 parent 1297eb3 commit 45695d9

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

mypyc/lib-rt/librt_internal.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,14 @@ _read_short_int(PyObject *data, uint8_t first) {
398398
}
399399
if ((first & FOUR_BYTES_INT_BIT) == 0) {
400400
_CHECK_READ(data, 1, CPY_INT_TAG)
401-
second = _READ(data, uint8_t)
401+
_READ(&second, data, uint8_t);
402402
return ((((Py_ssize_t)second) << 6) + (Py_ssize_t)(first >> 2) + MIN_TWO_BYTES_INT) << 1;
403403
}
404404
// The caller is responsible to verify this is called only for short ints.
405405
_CHECK_READ(data, 3, CPY_INT_TAG)
406406
// TODO: check if compilers emit optimal code for these two reads, and tweak if needed.
407-
second = _READ(data, uint8_t)
408-
two_more = _READ(data, uint16_t)
407+
_READ(&second, data, uint8_t);
408+
_READ(&two_more, data, uint16_t);
409409
#if PY_BIG_ENDIAN
410410
two_more = reverse_16(two_more);
411411
#endif
@@ -459,27 +459,27 @@ read_str(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwnames)
459459
static inline char
460460
_write_short_int(PyObject *data, Py_ssize_t real_value) {
461461
if (real_value >= MIN_ONE_BYTE_INT && real_value <= MAX_ONE_BYTE_INT) {
462-
_CHECK_SIZE(data, 1)
463-
_WRITE(data, uint8_t, (uint8_t)(real_value - MIN_ONE_BYTE_INT) << 1)
464-
((BufferObject *)data)->end += 1;
462+
_CHECK_WRITE(data, 1)
463+
_WRITE(data, uint8_t, (uint8_t)(real_value - MIN_ONE_BYTE_INT) << 1);
464+
((WriteBufferObject *)data)->ptr += 1;
465465
} else if (real_value >= MIN_TWO_BYTES_INT && real_value <= MAX_TWO_BYTES_INT) {
466-
_CHECK_SIZE(data, 2)
466+
_CHECK_WRITE(data, 2)
467467
#if PY_BIG_ENDIAN
468468
uint16_t to_write = ((uint16_t)(real_value - MIN_TWO_BYTES_INT) << 2) | TWO_BYTES_INT_BIT;
469469
_WRITE(data, uint16_t, reverse_16(to_write))
470470
#else
471-
_WRITE(data, uint16_t, ((uint16_t)(real_value - MIN_TWO_BYTES_INT) << 2) | TWO_BYTES_INT_BIT)
471+
_WRITE(data, uint16_t, ((uint16_t)(real_value - MIN_TWO_BYTES_INT) << 2) | TWO_BYTES_INT_BIT);
472472
#endif
473-
((BufferObject *)data)->end += 2;
473+
((WriteBufferObject *)data)->ptr += 2;
474474
} else {
475-
_CHECK_SIZE(data, 4)
475+
_CHECK_WRITE(data, 4)
476476
#if PY_BIG_ENDIAN
477477
uint32_t to_write = ((uint32_t)(real_value - MIN_FOUR_BYTES_INT) << 3) | FOUR_BYTES_INT_TRAILER;
478478
_WRITE(data, uint32_t, reverse_32(to_write))
479479
#else
480-
_WRITE(data, uint32_t, ((uint32_t)(real_value - MIN_FOUR_BYTES_INT) << 3) | FOUR_BYTES_INT_TRAILER)
480+
_WRITE(data, uint32_t, ((uint32_t)(real_value - MIN_FOUR_BYTES_INT) << 3) | FOUR_BYTES_INT_TRAILER);
481481
#endif
482-
((BufferObject *)data)->end += 4;
482+
((WriteBufferObject *)data)->ptr += 4;
483483
}
484484
return CPY_NONE;
485485
}
@@ -500,7 +500,7 @@ write_str_internal(PyObject *data, PyObject *value) {
500500
return CPY_NONE_ERROR;
501501
}
502502
// Write string content.
503-
_CHECK_SIZE(data, size)
503+
_CHECK_WRITE(data, size)
504504
char *ptr = ((WriteBufferObject *)data)->ptr;
505505
memcpy(ptr, chunk, size);
506506
((WriteBufferObject *)data)->ptr += size;
@@ -590,7 +590,7 @@ write_bytes_internal(PyObject *data, PyObject *value) {
590590
return CPY_NONE_ERROR;
591591
}
592592
// Write bytes content.
593-
_CHECK_SIZE(data, size)
593+
_CHECK_WRITE(data, size)
594594
char *ptr = ((WriteBufferObject *)data)->ptr;
595595
memcpy(ptr, chunk, size);
596596
((WriteBufferObject *)data)->ptr += size;
@@ -626,11 +626,11 @@ float format:
626626
static double
627627
read_float_internal(PyObject *data) {
628628
_CHECK_READ(data, 8, CPY_FLOAT_ERROR)
629-
char *ptr = ((BufferObject *)data)->ptr;
629+
char *ptr = ((ReadBufferObject *)data)->ptr;
630630
double res = PyFloat_Unpack8(ptr, 1);
631631
if (unlikely((res == -1.0) && PyErr_Occurred()))
632632
return CPY_FLOAT_ERROR;
633-
((BufferObject *)data)->ptr += 8;
633+
((ReadBufferObject *)data)->ptr += 8;
634634
return res;
635635
}
636636

@@ -652,12 +652,12 @@ read_float(PyObject *self, PyObject *const *args, size_t nargs, PyObject *kwname
652652

653653
static char
654654
write_float_internal(PyObject *data, double value) {
655-
_CHECK_SIZE(data, 8)
656-
char *ptr = ((BufferObject *)data)->ptr;
655+
_CHECK_WRITE(data, 8)
656+
char *ptr = ((WriteBufferObject *)data)->ptr;
657657
int res = PyFloat_Pack8(value, ptr, 1);
658658
if (unlikely(res == -1))
659659
return CPY_NONE_ERROR;
660-
((BufferObject *)data)->ptr += 8;
660+
((WriteBufferObject *)data)->ptr += 8;
661661
return CPY_NONE;
662662
}
663663

@@ -720,11 +720,11 @@ read_int_internal(PyObject *data) {
720720

721721
// Construct an int object from the byte array.
722722
_CHECK_READ(data, size, CPY_INT_TAG)
723-
char *ptr = ((BufferObject *)data)->ptr;
723+
char *ptr = ((ReadBufferObject *)data)->ptr;
724724
PyObject *num = _PyLong_FromByteArray((unsigned char *)ptr, size, 1, 0);
725725
if (num == NULL)
726726
return CPY_INT_TAG;
727-
((BufferObject *)data)->ptr += size;
727+
((ReadBufferObject *)data)->ptr += size;
728728
if (sign) {
729729
PyObject *old = num;
730730
num = PyNumber_Negative(old);
@@ -764,9 +764,9 @@ static inline int hex_to_int(char c) {
764764

765765
static inline char
766766
_write_long_int(PyObject *data, CPyTagged value) {
767-
_CHECK_SIZE(data, 1)
768-
_WRITE(data, uint8_t, LONG_INT_TRAILER)
769-
((BufferObject *)data)->end += 1;
767+
_CHECK_WRITE(data, 1)
768+
_WRITE(data, uint8_t, LONG_INT_TRAILER);
769+
((WriteBufferObject *)data)->end += 1;
770770

771771
PyObject *hex_str = NULL;
772772
PyObject* int_value = CPyTagged_AsObject(value);

0 commit comments

Comments
 (0)