Numworks Epsilon  1.4.1
Graphing Calculator Operating System
binary.c File Reference
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include "py/binary.h"
#include "py/smallint.h"
#include "py/objint.h"
#include "py/runtime.h"

Go to the source code of this file.

Macros

#define alignof(type)   offsetof(struct { char c; type t; }, t)
 
#define is_signed(typecode)   (typecode > 'Z')
 

Functions

size_t mp_binary_get_size (char struct_type, char val_type, mp_uint_t *palign)
 
mp_obj_t mp_binary_get_val_array (char typecode, void *p, mp_uint_t index)
 
long long mp_binary_get_int (mp_uint_t size, bool is_signed, bool big_endian, const byte *src)
 
mp_obj_t mp_binary_get_val (char struct_type, char val_type, byte **ptr)
 
void mp_binary_set_int (mp_uint_t val_sz, bool big_endian, byte *dest, mp_uint_t val)
 
void mp_binary_set_val (char struct_type, char val_type, mp_obj_t val_in, byte **ptr)
 
void mp_binary_set_val_array (char typecode, void *p, mp_uint_t index, mp_obj_t val_in)
 
void mp_binary_set_val_array_from_int (char typecode, void *p, mp_uint_t index, mp_int_t val)
 

Macro Definition Documentation

◆ alignof

#define alignof (   type)    offsetof(struct { char c; type t; }, t)

Definition at line 41 of file binary.c.

◆ is_signed

#define is_signed (   typecode)    (typecode > 'Z')

Definition at line 186 of file binary.c.

Function Documentation

◆ mp_binary_get_int()

long long mp_binary_get_int ( mp_uint_t  size,
bool  is_signed,
bool  big_endian,
const byte src 
)

Definition at line 164 of file binary.c.

◆ mp_binary_get_size()

size_t mp_binary_get_size ( char  struct_type,
char  val_type,
mp_uint_t palign 
)

Definition at line 44 of file binary.c.

◆ mp_binary_get_val()

mp_obj_t mp_binary_get_val ( char  struct_type,
char  val_type,
byte **  ptr 
)

Definition at line 187 of file binary.c.

◆ mp_binary_get_val_array()

mp_obj_t mp_binary_get_val_array ( char  typecode,
void *  p,
mp_uint_t  index 
)

Definition at line 115 of file binary.c.

◆ mp_binary_set_int()

void mp_binary_set_int ( mp_uint_t  val_sz,
bool  big_endian,
byte dest,
mp_uint_t  val 
)

Definition at line 233 of file binary.c.

◆ mp_binary_set_val()

void mp_binary_set_val ( char  struct_type,
char  val_type,
mp_obj_t  val_in,
byte **  ptr 
)

Definition at line 252 of file binary.c.

◆ mp_binary_set_val_array()

void mp_binary_set_val_array ( char  typecode,
void *  p,
mp_uint_t  index,
mp_obj_t  val_in 
)

Definition at line 317 of file binary.c.

◆ mp_binary_set_val_array_from_int()

void mp_binary_set_val_array_from_int ( char  typecode,
void *  p,
mp_uint_t  index,
mp_int_t  val 
)

Definition at line 344 of file binary.c.