Plow() pass by-pointer const TileTypeBitMask* instead of by-value

sizeof(TileTypeBitMask) == 32
This commit is contained in:
Darryl L. Miles 2025-02-17 09:49:04 +00:00 committed by Tim Edwards
parent 6db34b6aa9
commit bc5a4a0fb1
5 changed files with 10 additions and 9 deletions

View File

@ -212,7 +212,7 @@ wrongNumArgs:
layers = cmd->tx_argc == 2 ? "*,l,subcell,space" : cmd->tx_argv[2]; layers = cmd->tx_argc == 2 ? "*,l,subcell,space" : cmd->tx_argv[2];
if (!CmdParseLayers(layers, &mask)) if (!CmdParseLayers(layers, &mask))
break; break;
if (Plow(editDef, &editBox, mask, dir)) if (Plow(editDef, &editBox, &mask, dir))
break; break;
TxPrintf("Reduced plow size to stay within the boundary.\n"); TxPrintf("Reduced plow size to stay within the boundary.\n");

View File

@ -483,13 +483,13 @@ PlowSelection(def, pdistance, direction)
*/ */
bool bool
Plow(def, userRect, layers, direction) Plow(
CellDef *def; /* Cell being plowed */ CellDef *def, /* Cell being plowed */
Rect *userRect; /* The plow. Interpreted as per direction Rect *userRect, /* The plow. Interpreted as per direction
* below. * below.
*/ */
TileTypeBitMask layers; /* The initial plow only sees these layers */ const TileTypeBitMask *layersp,/* The initial plow only sees these layers */
int direction; /* One of GEO_NORTH, GEO_SOUTH, GEO_WEST, int direction) /* One of GEO_NORTH, GEO_SOUTH, GEO_WEST,
* or GEO_EAST. * or GEO_EAST.
*/ */
{ {
@ -497,6 +497,7 @@ Plow(def, userRect, layers, direction)
extern int plowWidthNumCalls; extern int plowWidthNumCalls;
extern int plowWidthNumChoices; extern int plowWidthNumChoices;
#endif /* COUNTWIDTHCALLS */ #endif /* COUNTWIDTHCALLS */
TileTypeBitMask layers = *layersp; /* TTMaskCopy(&layers, layersp) */
TileTypeBitMask lc; TileTypeBitMask lc;
Rect changedArea; Rect changedArea;
bool firstTime; bool firstTime;

View File

@ -118,7 +118,7 @@ PlowRandomTest(def)
dir = plowGenRandom(0, 3); dir = plowGenRandom(0, 3);
plowDir = dirs[dir]; plowDir = dirs[dir];
plowGenRect(&def->cd_bbox, &plowRect); plowGenRect(&def->cd_bbox, &plowRect);
(void) Plow(def, &plowRect, DBAllTypeBits, plowDir); (void) Plow(def, &plowRect, &DBAllTypeBits, plowDir);
TxPrintf("%s %d %d %d %d\n", dirnames[dir], TxPrintf("%s %d %d %d %d\n", dirnames[dir],
plowRect.r_xbot, plowRect.r_ybot, plowRect.r_xbot, plowRect.r_ybot,
plowRect.r_xtop, plowRect.r_ytop); plowRect.r_xtop, plowRect.r_ytop);

View File

@ -207,7 +207,7 @@ PlowTest(w, cmd)
okTypes = DBAllTypeBits; okTypes = DBAllTypeBits;
if (cmd->tx_argc > 3 && !CmdParseLayers(cmd->tx_argv[3], &okTypes)) if (cmd->tx_argc > 3 && !CmdParseLayers(cmd->tx_argv[3], &okTypes))
return; return;
if (!Plow(def, &editArea, okTypes, dir)) if (!Plow(def, &editArea, &okTypes, dir))
{ {
TxPrintf("Reduced plow size since we ran into the barrier.\n"); TxPrintf("Reduced plow size since we ran into the barrier.\n");
GeoTransRect(&EditToRootTransform, &editArea, &rootBox); GeoTransRect(&EditToRootTransform, &editArea, &rootBox);

View File

@ -30,7 +30,7 @@ extern int PlowDRCInit(), PlowDRCFinal();
extern bool PlowDRCLine(); extern bool PlowDRCLine();
/* Called by CmdPlow() */ /* Called by CmdPlow() */
extern bool Plow(); extern bool Plow(CellDef *def, Rect *userRect, const TileTypeBitMask *layersp, int direction);
/* Debugging command procedure */ /* Debugging command procedure */
extern int PlowTest(); extern int PlowTest();