summary refs log tree commit diff stats
path: root/hw/fmopl.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/fmopl.c')
-rw-r--r--hw/fmopl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/fmopl.c b/hw/fmopl.c
index 3df1806a91..d8a0f36b35 100644
--- a/hw/fmopl.c
+++ b/hw/fmopl.c
@@ -45,6 +45,10 @@
 #define PI 3.14159265358979323846
 #endif
 
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
 /* -------------------- for debug --------------------- */
 /* #define OPL_OUTPUT_LOG */
 #ifdef OPL_OUTPUT_LOG
@@ -595,7 +599,7 @@ static void init_timetables( FM_OPL *OPL , int ARRATE , int DRRATE )
 		OPL->AR_TABLE[i] = rate / ARRATE;
 		OPL->DR_TABLE[i] = rate / DRRATE;
 	}
-	for (i = 60;i < 76;i++)
+	for (i = 60; i < ARRAY_SIZE(OPL->AR_TABLE); i++)
 	{
 		OPL->AR_TABLE[i] = EG_AED-1;
 		OPL->DR_TABLE[i] = OPL->DR_TABLE[60];