Remove Lw and Hw macros from BN internals

I think this is a bit clearer just inlined into the call sites, and we
avoid squatting, even internally, such short names.

Change-Id: Ie432da87ae9405219eaca3bfa4c02596a3660362
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80307
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/bn/generic.cc.inc b/crypto/fipsmodule/bn/generic.cc.inc
index 9a42fa0..337dc35 100644
--- a/crypto/fipsmodule/bn/generic.cc.inc
+++ b/crypto/fipsmodule/bn/generic.cc.inc
@@ -44,24 +44,24 @@
   do {                                    \
     BN_ULLONG t;                          \
     t = (BN_ULLONG)(w) * (a) + (r) + (c); \
-    (r) = Lw(t);                          \
-    (c) = Hw(t);                          \
+    (r) = (BN_ULONG)(t);                  \
+    (c) = (BN_ULONG)((t) >> BN_BITS2);    \
   } while (0)
 
-#define mul(r, a, w, c)             \
-  do {                              \
-    BN_ULLONG t;                    \
-    t = (BN_ULLONG)(w) * (a) + (c); \
-    (r) = Lw(t);                    \
-    (c) = Hw(t);                    \
+#define mul(r, a, w, c)                \
+  do {                                 \
+    BN_ULLONG t;                       \
+    t = (BN_ULLONG)(w) * (a) + (c);    \
+    (r) = (BN_ULONG)(t);               \
+    (c) = (BN_ULONG)((t) >> BN_BITS2); \
   } while (0)
 
-#define sqr(r0, r1, a)        \
-  do {                        \
-    BN_ULLONG t;              \
-    t = (BN_ULLONG)(a) * (a); \
-    (r0) = Lw(t);             \
-    (r1) = Hw(t);             \
+#define sqr(r0, r1, a)                  \
+  do {                                  \
+    BN_ULLONG t;                        \
+    t = (BN_ULLONG)(a) * (a);           \
+    (r0) = (BN_ULONG)(t);               \
+    (r1) = (BN_ULONG)((t) >> BN_BITS2); \
   } while (0)
 
 #else
@@ -198,8 +198,8 @@
     BN_ULONG hi;                        \
     BN_ULLONG t = (BN_ULLONG)(a) * (b); \
     t += (c0); /* no carry */           \
-    (c0) = (BN_ULONG)Lw(t);             \
-    hi = (BN_ULONG)Hw(t);               \
+    (c0) = (BN_ULONG)(t);               \
+    hi = (BN_ULONG)((t) >> BN_BITS2);   \
     (c1) += (hi);                       \
     (c2) += (c1) < hi;                  \
   } while (0)
@@ -209,13 +209,13 @@
     BN_ULONG hi;                            \
     BN_ULLONG t = (BN_ULLONG)(a) * (b);     \
     BN_ULLONG tt = t + (c0); /* no carry */ \
-    (c0) = (BN_ULONG)Lw(tt);                \
-    hi = (BN_ULONG)Hw(tt);                  \
+    (c0) = (BN_ULONG)(tt);                  \
+    hi = (BN_ULONG)((tt) >> BN_BITS2);      \
     (c1) += hi;                             \
     (c2) += (c1) < hi;                      \
     t += (c0); /* no carry */               \
-    (c0) = (BN_ULONG)Lw(t);                 \
-    hi = (BN_ULONG)Hw(t);                   \
+    (c0) = (BN_ULONG)(t);                   \
+    hi = (BN_ULONG)((t) >> BN_BITS2);       \
     (c1) += hi;                             \
     (c2) += (c1) < hi;                      \
   } while (0)
@@ -225,8 +225,8 @@
     BN_ULONG hi;                              \
     BN_ULLONG t = (BN_ULLONG)(a)[i] * (a)[i]; \
     t += (c0); /* no carry */                 \
-    (c0) = (BN_ULONG)Lw(t);                   \
-    hi = (BN_ULONG)Hw(t);                     \
+    (c0) = (BN_ULONG)(t);                     \
+    hi = (BN_ULONG)((t) >> BN_BITS2);         \
     (c1) += hi;                               \
     (c2) += (c1) < hi;                        \
   } while (0)
diff --git a/crypto/fipsmodule/bn/internal.h b/crypto/fipsmodule/bn/internal.h
index 9e54b41..ee881a9 100644
--- a/crypto/fipsmodule/bn/internal.h
+++ b/crypto/fipsmodule/bn/internal.h
@@ -105,11 +105,6 @@
         sizeof(x) / sizeof(BN_ULONG), 0, BN_FLG_STATIC_DATA \
   }
 
-#if defined(BN_ULLONG)
-#define Lw(t) ((BN_ULONG)(t))
-#define Hw(t) ((BN_ULONG)((t) >> BN_BITS2))
-#endif
-
 // bn_minimal_width returns the minimal number of words needed to represent
 // |bn|.
 int bn_minimal_width(const BIGNUM *bn);