mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-19 08:46:32 +00:00
Berry update from upstream (#23159)
This commit is contained in:
parent
e1f7ee26fa
commit
ce92723c41
@ -354,9 +354,6 @@ const bntvmodule_t be_native_module(_module) = { \
|
||||
|
||||
#else
|
||||
|
||||
// #define be_define_const_bytes(_name, ...) \
|
||||
// const uint8_t be_const_bin_##_name[] = { __VA_ARGS__ }
|
||||
|
||||
#define be_define_const_str_weak(_name, _s, _len) \
|
||||
const bcstring be_const_str_##_name = { \
|
||||
NULL, \
|
||||
|
@ -234,7 +234,9 @@ int be_nfunc_open(bvm *vm)
|
||||
{ "flush", i_flush },
|
||||
{ "close", i_close },
|
||||
{ "deinit", i_close },
|
||||
#if BE_USE_BYTECODE_SAVER
|
||||
{ "savecode", i_savecode },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
fname = argc >= 1 && be_isstring(vm, 1) ? be_tostring(vm, 1) : NULL;
|
||||
|
@ -40,10 +40,15 @@
|
||||
#elif defined(_MSC_VER)
|
||||
#define popcount(v) __popcnt(v)
|
||||
|
||||
// Find a free slot in the space bitmask
|
||||
// Find the least significant 1-bit in x and return its 1-based index.
|
||||
static int ffs(unsigned x)
|
||||
{
|
||||
unsigned long i;
|
||||
return _BitScanForward(&i, x) ? i : 0;
|
||||
// NOTE: _BitScanForward is 0-based, see:
|
||||
// https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64?view=msvc-170
|
||||
// _BitScanForward(&index, 12) populates index with 2
|
||||
return _BitScanForward(&i, x) ? i + 1 : 0;
|
||||
}
|
||||
#else
|
||||
/* https://github.com/hcs0/Hackers-Delight/blob/master/pop.c.txt - count number of 1-bits */
|
||||
|
@ -324,8 +324,8 @@ static void end_func(bparser *parser)
|
||||
proto->codesize = finfo->pc;
|
||||
proto->ktab = be_vector_release(vm, &finfo->kvec);
|
||||
proto->nconst = be_vector_count(&finfo->kvec);
|
||||
proto->nproto = be_vector_count(&finfo->pvec);
|
||||
proto->ptab = be_vector_release(vm, &finfo->pvec);
|
||||
proto->nproto = be_vector_count(&finfo->pvec);
|
||||
#if BE_USE_MEM_ALIGNED
|
||||
proto->code = be_move_to_aligned(vm, proto->code, proto->codesize * sizeof(binstruction)); /* move `code` to 4-bytes aligned memory region */
|
||||
proto->ktab = be_move_to_aligned(vm, proto->ktab, proto->nconst * sizeof(bvalue)); /* move `ktab` to 4-bytes aligned memory region */
|
||||
|
Loading…
x
Reference in New Issue
Block a user