Fix botched disassembler backport
This commit is contained in:
+17
-17
@@ -5,28 +5,28 @@
|
||||
#include <string.h>
|
||||
#include <vbu.h>
|
||||
|
||||
/* Memory management */
|
||||
#ifndef VBU_REALLOC
|
||||
#include <stdlib.h>
|
||||
#define VBU_REALLOC realloc
|
||||
#else
|
||||
extern void* VBU_REALLOC(void *, size_t);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/***************************** Library Functions *****************************/
|
||||
|
||||
/* Sign-extend an integer of variable width */
|
||||
static int32_t SignExtend(int32_t value, int32_t bits) {
|
||||
#ifndef VB_SIGNED_PROPAGATE
|
||||
value &= ~((uint32_t) 0xFFFFFFFF << bits);
|
||||
bits = (int32_t) 1 << (bits - (int32_t) 1);
|
||||
return (value ^ bits) - bits;
|
||||
#else
|
||||
return value << (32 - bits) >> (32 - bits);
|
||||
#endif
|
||||
/* Memory manager */
|
||||
#ifdef VBU_MEMMGR
|
||||
extern void* VBU_MEMMGR(void *ptr, size_t size);
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
static void* VBU_MEMMGR(void *ptr, size_t size) {
|
||||
|
||||
/* Free a buffer */
|
||||
if (size == 0) {
|
||||
if (ptr != NULL)
|
||||
free(ptr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create or resize a buffer */
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user