Blame src/internal/mdso_object_impl.h

5c48f6
/****************************************************************/
5c48f6
/*  mdso: midipix dso scavenger                                 */
473806
/*  Copyright (C) 2015--2024  SysDeer Technologies, LLC         */
5c48f6
/*  Released under GPLv2 and GPLv3; see COPYING.MDSO.           */
5c48f6
/****************************************************************/
5c48f6
5c48f6
#include <stdint.h>
5c48f6
5c48f6
static inline void mdso_obj_write_short(unsigned char * ch, uint16_t val)
5c48f6
{
5c48f6
	ch[0] = val;
5c48f6
	ch[1] = val >> 8;
5c48f6
}
5c48f6
5c48f6
static inline void mdso_obj_write_long(unsigned char * ch, uint32_t val)
5c48f6
{
5c48f6
	ch[0] = val;
5c48f6
	ch[1] = val >> 8;
5c48f6
	ch[2] = val >> 16;
5c48f6
	ch[3] = val >> 24;
5c48f6
}
5c48f6
5c48f6
static inline void mdso_obj_write_quad(unsigned char * ch, uint64_t val)
5c48f6
{
5c48f6
	ch[0] = val;
5c48f6
	ch[1] = val >> 8;
5c48f6
	ch[2] = val >> 16;
5c48f6
	ch[3] = val >> 24;
5c48f6
	ch[4] = val >> 32;
5c48f6
	ch[5] = val >> 40;
5c48f6
	ch[6] = val >> 48;
5c48f6
	ch[7] = val >> 56;
5c48f6
}
6a7467
6a7467
static inline void mdso_obj_write_dec(unsigned char * ch, uint64_t dec)
6a7467
{
6a7467
	int      digits;
6a7467
	uint64_t val;
6a7467
6a7467
	*ch = '0';
6a7467
6a7467
	for (digits=0,val=dec; val; digits++)
6a7467
		val /= 10;
6a7467
6a7467
	for (val=dec; val; val/=10)
6a7467
		ch[--digits] = (val % 10) + '0';
6a7467
}