diff util.c @ 768:2f48a3c187c6

Add support for reading cartridge memory map from ROM database, though without EEPROM support for now
author Michael Pavone <pavone@retrodev.com>
date Tue, 07 Jul 2015 19:33:33 -0700
parents 206c449eaa81
children 13d3744b170e
line wrap: on
line diff
--- a/util.c	Mon Jul 06 19:46:46 2015 -0700
+++ b/util.c	Tue Jul 07 19:33:33 2015 -0700
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
+#include <stdint.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -68,6 +69,16 @@
 	return text+1;
 }
 
+uint32_t nearest_pow2(uint32_t val)
+{
+	uint32_t ret = 1;
+	while (ret < val)
+	{
+		ret = ret << 1;
+	}
+	return ret;
+}
+
 static char * exe_str;
 
 void set_exe_str(char * str)