]> Cypherpunks repositories - gostls13.git/commitdiff
use cc provided xlog2 instead of system log2.
authorRuss Cox <rsc@golang.org>
Sat, 6 Jun 2009 06:12:07 +0000 (23:12 -0700)
committerRuss Cox <rsc@golang.org>
Sat, 6 Jun 2009 06:12:07 +0000 (23:12 -0700)
(on plan 9 cc calls it log2, but that conflicts here.)
the difference is that xlog2 returns -1 on non powers of 2.
8c was rewriting /10 into /8.

R=ken
OCL=29968
CL=29968

src/cmd/8c/cgen.c

index 8c5bf7b155d2ece8cf303357134c7f47d73de24a..1df03ef50c3a1c26c4a4274ad58c274dea814f79 100644 (file)
@@ -346,7 +346,7 @@ cgen(Node *n, Node *nn)
                                c = r->vconst;
                                if(c < 0)
                                        c = -c;
-                               v = log2(c);
+                               v = xlog2(c);
                                if(v < 0)
                                        break;
                                /* fall thru */
@@ -609,7 +609,7 @@ cgen(Node *n, Node *nn)
                                c = r->vconst;
                                if(c < 0)
                                        c = -c;
-                               v = log2(c);
+                               v = xlog2(c);
                                if(v < 0)
                                        break;
                                /* fall thru */