Skip to content

Commit 0f32d7e

Browse files
committed
Found another instance if signed ints <<-shifted
Also reacted to @seb's comments in PR 1575.
1 parent 3c6b533 commit 0f32d7e

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/emc/usr_intf/emcsched.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void SchedEntry::setTool(int t) {
190190

191191
static void crcInit() {
192192
crc rmdr;
193-
int i;
193+
unsigned int i;
194194
uint32_t bit;
195195

196196
for (i = 0; i < 256; ++i)

src/hal/drivers/hal_gm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,14 +1126,15 @@ read(void *arg, long period)
11261126
{
11271127
gm_device_t *device = (gm_device_t *)arg;
11281128
card *pCard = device->pCard;
1129+
unsigned int i;
11291130
hal_u32_t temp;
1130-
1131+
11311132
//basic card functionality: watchdog, switches, estop
11321133
card_mgr(arg, period);
11331134

11341135
//read parallel IOs
11351136
temp=pCard->gpio;
1136-
for(unsigned int i = 0; i < 32; i++)
1137+
for(i = 0; i < 32; i++)
11371138
{
11381139
*(device->gpio[i].in) = (hal_bit_t)((temp & ((unsigned int) 1 << i)) == 0 ? 0 : 1);
11391140
*(device->gpio[i].inNot) = (hal_bit_t)((temp & ((unsigned int) 1 << i)) == 0 ? 1 : 0);

src/hal/drivers/opto_ac5.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ Device_DigitalOutWrite(void *arg, long period)
402402
board_data_t *pboard = (board_data_t *)arg;
403403
DigitalPinsParams *pDigital;
404404
int portnum=0;
405+
unsigned int i,j;
405406
unsigned long pins, offset=DATA_WRITE_OFFSET_0,mask;
406407

407408
// For each port.
@@ -412,7 +413,7 @@ Device_DigitalOutWrite(void *arg, long period)
412413
pins=0;
413414

414415
// For each pin.
415-
for(unsigned int j = 0; j < 24; j++, pDigital++)
416+
for(j = 0; j < 24; j++, pDigital++)
416417
{
417418
if ((pboard->port[portnum].mask & mask) !=0) //is it an output?
418419
{
@@ -421,19 +422,19 @@ Device_DigitalOutWrite(void *arg, long period)
421422
( *(pDigital->pValue) && (pDigital->invert) ))
422423
{ pins |= mask; }
423424
}
424-
mask <<=1; // shift mask
425+
mask <<=1; // shift mask
425426

426427
}
427428

428429
// CHECK LED PINS
429430
pDigital = &pboard->port[portnum].io[23];//one before what we want to check
430-
for (unsigned int i = 0; i < 2; i++)
431-
{
432-
mask = (unsigned int) 1 << (31-i);
433-
pDigital++;
431+
for (i = 0; i < 2; i++)
432+
{
433+
mask = (unsigned int) 1 << (31-i);
434+
pDigital++;
434435

435-
if ( *(pDigital->pValue) == 0 ) { pins |= mask; }
436-
}
436+
if ( *(pDigital->pValue) == 0 ) { pins |= mask; }
437+
}
437438
// Write digital I/O register.
438439
writel(pins,pboard->base + (offset));
439440
portnum++;

0 commit comments

Comments
 (0)