Berry minor fixes to remove warnings (#23071)

This commit is contained in:
s-hadinger 2025-02-25 22:28:13 +01:00 committed by GitHub
parent aecba92da4
commit e92e411040
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 40 deletions

View File

@ -11,25 +11,25 @@
#include "be_mem.h" #include "be_mem.h"
static void int64_toa(int64_t num, uint8_t* str) { static void int64_toa(int64_t num, uint8_t* str) {
uint64_t sum = num; uint64_t sum = num;
if (num < 0) { if (num < 0) {
sum = -num; sum = -num;
str[0] = '-'; str[0] = '-';
str++; str++;
} }
int len = 0; int len = 0;
do { do {
str[len++] = '0' + sum % 10LL; str[len++] = '0' + sum % 10LL;
sum /= 10LL; sum /= 10LL;
} while (sum); } while (sum);
str[len] = '\0'; str[len] = '\0';
/* strrev */ /* strrev */
int i, j; int i, j;
for (i = 0, j = len - 1; i < j; i++, j--){ for (i = 0, j = len - 1; i < j; i++, j--){
uint8_t a = str[i]; uint8_t a = str[i];
str[i] = str[j]; str[i] = str[j];
str[j] = a; str[j] = a;
} }
} }
/* constructor*/ /* constructor*/
@ -320,15 +320,15 @@ be_local_closure(toint64, /* name */
&be_const_str_toint64, &be_const_str_toint64,
&be_const_str_solidified, &be_const_str_solidified,
( &(const binstruction[ 9]) { /* code */ ( &(const binstruction[ 9]) { /* code */
0x4C040000, // 0000 LDNIL R1 0x4C040000, // 0000 LDNIL R1
0x1C040001, // 0001 EQ R1 R0 R1 0x1C040001, // 0001 EQ R1 R0 R1
0x78060001, // 0002 JMPF R1 #0005 0x78060001, // 0002 JMPF R1 #0005
0x4C040000, // 0003 LDNIL R1 0x4C040000, // 0003 LDNIL R1
0x80040200, // 0004 RET 1 R1 0x80040200, // 0004 RET 1 R1
0xB8060000, // 0005 GETNGBL R1 K0 0xB8060000, // 0005 GETNGBL R1 K0
0x5C080000, // 0006 MOVE R2 R0 0x5C080000, // 0006 MOVE R2 R0
0x7C040200, // 0007 CALL R1 1 0x7C040200, // 0007 CALL R1 1
0x80040200, // 0008 RET 1 R1 0x80040200, // 0008 RET 1 R1
}) })
) )
); );

View File

@ -27,26 +27,26 @@ static int call_berry_cb(int num, int v0, int v1, int v2, int v3, int v4);
#define BERRY_CB(n) int berry_cb_##n(int v0, int v1, int v2, int v3, int v4) { return call_berry_cb(n, v0, v1, v2, v3, v4); } #define BERRY_CB(n) int berry_cb_##n(int v0, int v1, int v2, int v3, int v4) { return call_berry_cb(n, v0, v1, v2, v3, v4); }
// list the callbacks // list the callbacks
BERRY_CB(0); BERRY_CB(0)
BERRY_CB(1); BERRY_CB(1)
BERRY_CB(2); BERRY_CB(2)
BERRY_CB(3); BERRY_CB(3)
BERRY_CB(4); BERRY_CB(4)
BERRY_CB(5); BERRY_CB(5)
BERRY_CB(6); BERRY_CB(6)
BERRY_CB(7); BERRY_CB(7)
BERRY_CB(8); BERRY_CB(8)
BERRY_CB(9); BERRY_CB(9)
BERRY_CB(10); BERRY_CB(10)
BERRY_CB(11); BERRY_CB(11)
BERRY_CB(12); BERRY_CB(12)
BERRY_CB(13); BERRY_CB(13)
BERRY_CB(14); BERRY_CB(14)
BERRY_CB(15); BERRY_CB(15)
BERRY_CB(16); BERRY_CB(16)
BERRY_CB(17); BERRY_CB(17)
BERRY_CB(18); BERRY_CB(18)
BERRY_CB(19); BERRY_CB(19)
// array of callbacks // array of callbacks
static const berry_callback_t berry_callback_array[BE_MAX_CB] = { static const berry_callback_t berry_callback_array[BE_MAX_CB] = {