<i>rand() > 1 on 64-bit platform</i> status still Open with 4 other changes
by
.
D 2000-11-02T13:23:41
J icomment Here's\sa\spatch\sthat\sfixes\sthe\sbug\s(test\ssuite\spatched\stoo):\n\n***\sgeneric/tclExecute.c.orig\s\s\sWed\sNov\s\s1\s23:27:14\s2000\n---\sgeneric/tclExecute.c\s\s\s\s\s\s\s\sThu\sNov\s\s2\s00:29:05\s2000\n***************\n***\s4094,4107\s****\n\s\s\s\s\s\s}\n\s\s\n\s\s\s\s\s\s/*\n!\s\s\s\s\s\s*\sOn\s64-bit\sarchitectures\swe\sneed\sto\smask\soff\sthe\supper\sbits\sto\n!\s\s\s\s\s\s*\sensure\swe\sonly\shave\sa\s32-bit\srange.\s\sThe\sconstant\shas\sthe\n!\s\s\s\s\s\s*\sbizarre\sform\sbelow\sin\sorder\sto\smake\ssure\sthat\sit\sdoesn't\n!\s\s\s\s\s\s*\sget\ssign-extended\s(the\srules\sfor\ssign\sextension\sare\svery\n!\s\s\s\s\s\s*\sconcat,\sparticularly\son\s64-bit\smachines).\n\s\s\s\s\s\s\s*/\n\s\s\n!\s\s\s\s\siPtr->randSeed\s&=\s((((unsigned\slong)\s0xfffffff)\s<<\s4)\s|\s0xf);\n\s\s\s\s\s\sdResult\s=\siPtr->randSeed\s*\s(1.0/RAND_IM);\n\s\s\n\s\s\s\s\s\s/*\n---\s4094,4108\s----\n\s\s\s\s\s\s}\n\s\s\n\s\s\s\s\s\s/*\n!\s\s\s\s\s\s*\sWe're\sabout\sto\sderive\sthe\sdouble\sdResult\sby\sdividing\sthe\slong\n!\s\s\s\s\s\s*\siPtr->randSeed\sby\sRAND_IM.\s\sWe\swant\sdResult\sto\sbe\sin\sthe\srange\n!\s\s\s\s\s\s*\s0\s<=\sdResult\s<\s1.\s\sIn\scase,\syou\sdidn't\snotice,\sRAND_IM\s=\s2^31\s-\s1,\n!\s\s\s\s\s\s*\sor,\sin\shex,\s0x7fffffff.\s\sSo,\swe\sneed\sto\sbe\ssure\sthat\siPtr->randSeed\n!\s\s\s\s\s\s*\sis\sin\sthe\srange\s0x0\s<=\siPtr\s<\s0x7fffffff.\s\sWe\scan\saccomplish\sthis\n!\s\s\s\s\s\s*\sby\smasking\saway\sall\sbut\sthe\s31\sleast\ssignificant\sbits.\n\s\s\s\s\s\s\s*/\n\s\s\n!\s\s\s\s\siPtr->randSeed\s&=\s(unsigned\slong)\s0x7fffffff;\n\s\s\s\s\s\sdResult\s=\siPtr->randSeed\s*\s(1.0/RAND_IM);\n\s\s\n\s\s\s\s\s\s/*\n***\stests/expr-old.test.orig\s\s\s\sThu\sNov\s\s2\s00:15:22\s2000\n---\stests/expr-old.test\sThu\sNov\s\s2\s00:04:58\s2000\n***************\n***\s825,830\s****\n---\s825,833\s----\n\s\stest\sexpr-old-32.51\s{math\sfunctions\sin\sexpressions}\s{\n\s\s\s\s\s\slist\s[catch\s{expr\s{srand([lindex\s"6ty"\s0])}}\smsg]\s$msg\n\s\s}\s{1\s{argument\sto\smath\sfunction\sdidn't\shave\snumeric\svalue}}\n+\stest\sexpr-old-32.52\s{math\sfunctions\sin\sexpressions}\s{\n+\s\s\s\s\sexpr\ssrand(1<<37)\s<\s1\n+\s}\s{1}\n\s\s\n\s\stest\sexpr-old-33.1\s{conversions\sand\sfancy\sargs\sto\smath\sfunctions}\s{\n\s\s\s\s\s\sexpr\shypot\s(\s3\s,\s4\s)\n\nThis\spatch\sreplaces\sa\stricky\sbit\sof\scode\sespecially\swritten\sto\ssupport\s64-bit\splatforms\s(but\sdid\snot\swork\son\smine)\swith\sa\ssimpler\sapproach\sthat\sworks\son\smy\s64-bit\splatform.\s\sThe\spatch\sappears\sto\sme\sto\sbe\sportable,\sbut\sI\ssuppose\ssome\stesting\son\sother\s64-bit\splatforms\swould\sbe\sa\sgood\sidea.\n\nNow\sthe\sprocess\squestions:\n\nDoes\sthe\spatch\sbelong\shere,\sor\sshould\sit\sgo\sin\sthe\sPatch\sManager?\s\sIf\sit\sbelongs\sin\sthe\sPatch\sManager,\show\sshould\sI\scross-reference\sthe\sbug\sit\sfixes?\n\nWho\swill\scheck\sin\sthis\spatch?\s\sI'm\snot\s(yet)\sa\smaintainer\sof\sanything,\sand\sbesides,\sas\sfar\sas\sI\scan\stell,\sI\sno\slonger\shave\scommit\saccess\sto\sany\sCVS\srepository\scontaining\sTcl.\n\nWhy\sdid\sI\shave\sto\smake\smyself\sa\sBug\sTracker\sTech\s&\sAdmin\njust\sto\sbe\sable\sto\spost\sthis\sfollowup\scomment?\s\sShouldn't\swe\sset\sup\sthe\sBug\sTracker\sto\saccept\sfollowup\scomments\s(that\smight\scontain\sbug\sfix\ssubmissions)\sfrom\sanybody?\s\sIs\sthat\snot\spossible?\n
J login dgp
J mimetype text/plain
J username dgp
K 221072ffffffffffffffffffffffffffffffffff
U dgp
Z b774eb9844e8d29b32670741eabc062a