mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
78410fc79a
commit
c653d38ffd
@ -108,8 +108,13 @@ struct CodeObjectSerializer{
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void write_bytes(T v){
|
void write_bytes(T v){
|
||||||
static_assert(std::is_trivially_copyable<T>::value);
|
static_assert(std::is_trivially_copyable<T>::value);
|
||||||
buffer += 'm';
|
buffer += 'x';
|
||||||
buffer.append((const char*)&v, sizeof(T));
|
char* p = (char*)&v;
|
||||||
|
for(int i=0; i<sizeof(T); i++){
|
||||||
|
char c = p[i];
|
||||||
|
buffer += "0123456789abcdef"[(c >> 4) & 0xf];
|
||||||
|
buffer += "0123456789abcdef"[c & 0xf];
|
||||||
|
}
|
||||||
buffer += END;
|
buffer += END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user