JANITORIAL: use common ARRAYSIZE macro

This commit is contained in:
Michael Kuerbis
2026-02-14 13:22:23 +01:00
committed by Filippos Karapetis
parent 4640c5c9cf
commit fc6bb6eaac
4 changed files with 10 additions and 5 deletions
+4 -1
View File
@@ -33,6 +33,9 @@
#include "ROMInfo.h"
#include "TVA.h"
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/util.h"
#if MT32EMU_MONITOR_SYSEX > 0
#include "mmath.h"
#endif
@@ -575,7 +578,7 @@ bool Synth::loadControlROM(const ROMImage &controlROMImage) {
// Control ROM successfully loaded, now check whether it's a known type
controlROMMap = NULL;
controlROMFeatures = NULL;
for (unsigned int i = 0; i < sizeof(ControlROMMaps) / sizeof(ControlROMMaps[0]); i++) {
for (unsigned int i = 0; i < ARRAYSIZE(ControlROMMaps); i++) {
if (strcmp(controlROMInfo->shortName, ControlROMMaps[i].shortName) == 0) {
controlROMMap = &ControlROMMaps[i];
controlROMFeatures = &controlROMMap->featureSet;
+2 -2
View File
@@ -496,14 +496,14 @@ Filter::Filter() {
// Create mappings from FC to cutoff frequency.
interpolate(f0_points_6581, f0_points_6581
+ sizeof(f0_points_6581)/sizeof(*f0_points_6581) - 1,
+ ARRAYSIZE(f0_points_6581) - 1,
PointPlotter<sound_sample>(f0_6581), 1.0);
mixer_DC = (-0xfff*0xff/18) >> 7;
f0 = f0_6581;
f0_points = f0_points_6581;
f0_count = sizeof(f0_points_6581)/sizeof(*f0_points_6581);
f0_count = ARRAYSIZE(f0_points_6581);
set_w0();
set_Q();
+2 -1
View File
@@ -20,6 +20,7 @@
*/
#include "common/scummsys.h"
#include "common/util.h"
/* Common memory code used by the Indeo decoder
*
@@ -33,7 +34,7 @@
namespace Image {
namespace Indeo {
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
#define FF_ARRAY_ELEMS(a) ARRAYSIZE(a)
#define FFALIGN(x, a) (((x) + (a)-1) & ~((a)-1))
#define FFSIGN(a) ((a) > 0 ? 1 : -1)
#define MAX_INTEGER 0x7ffffff
+2 -1
View File
@@ -29,6 +29,7 @@
#include "common/fs.h"
#include "common/stream.h"
#include "common/system.h"
#include "common/util.h"
#include "graphics/surface.h"
#include "graphics/managed_surface.h"
@@ -984,7 +985,7 @@ public:
for (int g = 255; g >= 0; g = (g == 255 ? 128 : (g == 128 ? 0 : -1))) {
for (int b = 255; b >= 0; b = (b == 255 ? 128 : (b == 128 ? 0 : -1))) {
for (int flipping = 0; flipping <= 3; flipping++) {
for (int rect = 0; rect < (int)(sizeof(srcs)/sizeof(srcs[0])); rect++) {
for (int rect = 0; rect < ARRAYSIZE(srcs); rect++) {
oldSurfDest.fillRect(Common::Rect(0, 0, oldSurfDest.w, oldSurfDest.h), oldSurfDest.format.ARGBToColor(ba, br, bg, bb));
oldSurf._alphaMode = (Graphics::AlphaType)alphaType;
oldSurf.blit(oldSurfDest, dsts[rect].left, dsts[rect].top, flipping, &srcs[rect], MS_ARGB(a, r, g, b), dsts[rect].width(), dsts[rect].height(), (Graphics::TSpriteBlendMode)blendMode);