Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 4afc437

Browse files
committed
Fix for issue #65 (constant folding of unsigned right shift).
1 parent 375128b commit 4afc437

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

amx/amxcons.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* cannot always be implemented with portable C functions. In other words,
55
* these routines must be ported to other environments.
66
*
7-
* Copyright (c) CompuPhase, 1997-2020
7+
* Copyright (c) CompuPhase, 1997-2021
88
*
99
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
1010
* use this file except in compliance with the License. You may obtain a copy
@@ -18,7 +18,7 @@
1818
* License for the specific language governing permissions and limitations
1919
* under the License.
2020
*
21-
* Version: $Id: amxcons.c 6131 2020-04-29 19:47:15Z thiadmer $
21+
* Version: $Id: amxcons.c 6335 2021-07-31 19:31:11Z thiadmer $
2222
*/
2323

2424
#if defined _UNICODE || defined __UNICODE__ || defined UNICODE

compiler/sc1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* originally created by Ron Cain, july 1980, and enhanced by James E. Hendrix.
88
* The modifications in Pawn come close to a complete rewrite, though.
99
*
10-
* Copyright CompuPhase, 1997-2020
10+
* Copyright CompuPhase, 1997-2021
1111
* Copyright J.E. Hendrix, 1982, 1983
1212
* Copyright R. Cain, 1980
1313
*
@@ -23,7 +23,7 @@
2323
* License for the specific language governing permissions and limitations
2424
* under the License.
2525
*
26-
* Version: $Id: sc1.c 6130 2020-04-29 12:35:51Z thiadmer $
26+
* Version: $Id: sc1.c 6335 2021-07-31 19:31:11Z thiadmer $
2727
*/
2828
#include <assert.h>
2929
#include <ctype.h>

compiler/sc3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Pawn compiler - Recursive descend expresion parser
22
*
3-
* Copyright (c) CompuPhase, 1997-2017
3+
* Copyright (c) CompuPhase, 1997-2021
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
66
* use this file except in compliance with the License. You may obtain a copy
@@ -14,7 +14,7 @@
1414
* License for the specific language governing permissions and limitations
1515
* under the License.
1616
*
17-
* Version: $Id: sc3.c 6131 2020-04-29 19:47:15Z thiadmer $
17+
* Version: $Id: sc3.c 6335 2021-07-31 19:31:11Z thiadmer $
1818
*/
1919
#include <assert.h>
2020
#include <stdio.h>
@@ -834,7 +834,7 @@ static cell calc(cell left,void (*oper)(),cell right,char *boolresult)
834834
else if (oper==os_sar)
835835
return (left >> (int)right);
836836
else if (oper==ou_sar)
837-
return ((ucell)left >> (ucell)right);
837+
return ((ucell)(left & (~(~(ucell)0 << pc_cellsize*8))) >> (ucell)right);
838838
else if (oper==ob_sal)
839839
return ((ucell)left << (int)right);
840840
else if (oper==ob_add)

0 commit comments

Comments
 (0)