<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">Actually, I should have noticed. Word.LeftShift and Word.RightShift both check the range of the shift parameter. It's not the shift that is out of range. It is the shift constant (in this case 630). If you try Shift(FIRST(LONGINT), -630) you get 0 as expected.</span></div></span></span><br class="Apple-interchange-newline">
</div><div>So, in fact the run-time error is correct! 630 is not in the range [0..63].</div>
<br><div><div>On 2 Mar 2010, at 13:54, Tony Hosking wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I'm trying to understand this. Surely shifting right will never be out of range? Looks like something is broken.</div>
<br><div><div>On 2 Mar 2010, at 09:04, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">PutLH(Long.RightShift(FIRST(LONGINT), 630)); PutT("\n");<br> <br> <br>I'm guessing the warning is all you're supposed to get here?<br> <br> <br>C:\dev2\cm3.2\m3-sys\m3tests\src\p2\p227>cm3<br>--- building in NT386 ---<br>new source -> compiling Main.m3<br>"..\Main.m3", line 894: warning: value out of range<br><br>***<br>*** runtime error:<br>*** An enumeration or subrange value was out of range.<br>*** file "..\src\TWordN.m3", line 129<br>***<br>Stack trace:<br> FP PC Procedure<br>--------- --------- -------------------------------<br> 0x12f0dc 0x48791a RightShift + 0x35 in ..\src\TWordN.m3<br> 0x12f15c 0x47c62f doshift + 0x2c6 in ..\src\Stackx86.m3<br> 0x12f188 0x4485d2 shift_right + 0x1b2 in ..\src\M3x86.m3<br> 0x12f1ac 0x6414ed shift_right + 0xf5 in ..\src\M3CG_Check.m3<br> 0x12f1d4 0x505a4f Shift_right + 0x87 in ..\src\misc\CG.m3<br> 0x12f1f8 0x570641 CompileR + 0x1da in ..\NT386\LongShift.m3 => ..\src\builti<br>nWord\Shift.mg<br> 0x12f218 0x5cec2f Compile + 0x83 in ..\src\exprs\CallExpr.m3<br> 0x12f234 0x5bfee4 Compile + 0x53 in ..\src\exprs\Expr.m3<br> 0x12f274 0x5d19a7 EmitChecks + 0xdf in ..\src\exprs\CheckExpr.m3<br> 0x12f2b4 0x5c8b15 GenOrdinal + 0xa6 in ..\src\values\Formal.m3<br>......... ......... ... more frames ...<br> <br></div></span></blockquote></div><br></div></blockquote></div><br></body></html>