Berry `int64` added `low32()` and `high32()` methods, used in Matter (#21728)

This commit is contained in:
s-hadinger 2024-07-04 19:19:21 +02:00 committed by GitHub
parent dfa5b46494
commit 522d7f6ee4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- Support for Sonoff POWCT Ring (#21131)
- NeoPool data validation and communication statistics default enabled for ESP32 only (#21721)
- `FUNC_BUTTON_PRESSED` now contains `press_counter` encoded in `XdrvMailbox.command_code` (#21724)
- Berry `int64` added `low32()` and `high32()` methods, used in Matter
### Breaking Changed

View File

@ -212,6 +212,16 @@ int64_t* int64_frombytes(bvm *vm, uint8_t* ptr, size_t len, int32_t idx) {
}
BE_FUNC_CTYPE_DECLARE(int64_frombytes, "int64", "@(bytes)~[i]")
int32_t int64_low32(int64_t *i64) {
return (int32_t) *i64;
}
BE_FUNC_CTYPE_DECLARE(int64_low32, "i", "(int64)")
int32_t int64_high32(int64_t *i64) {
return (int32_t) (*i64 >> 32);
}
BE_FUNC_CTYPE_DECLARE(int64_high32, "i", "(int64)")
/*
def toint64(i)
@ -305,5 +315,8 @@ class be_class_int64 (scope: global, name: int64) {
tobytes, ctype_func(int64_tobytes)
frombytes, static_ctype_func(int64_frombytes)
low32, ctype_func(int64_low32) // return low 32 bits as int
high32, ctype_func(int64_high32) // return high 32 bits as int
}
@const_object_info_end */