mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
78410fc79a
commit
c653d38ffd
@ -108,8 +108,13 @@ struct CodeObjectSerializer{
|
||||
template<typename T>
|
||||
void write_bytes(T v){
|
||||
static_assert(std::is_trivially_copyable<T>::value);
|
||||
buffer += 'm';
|
||||
buffer.append((const char*)&v, sizeof(T));
|
||||
buffer += 'x';
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user