NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/49745: tests/include/sys/t_bitops: improvement



At Sun, 15 Mar 2015 10:32:48 -0400,
Christos Zoulas wrote:
> |  >  | >Description:
> |  >  | The current ilog2()'s implementation consists of 32bit variable
> |  >  | part, 64bit variable part and constant part.  But 'ilog2_basic'
> |  >  | test checks only 64bit variable.  32bit variable and constant
> |  >  | were not checked.
> |  :
> |  >  I would prefer if you put the constants in an array and loop instead
> |  >  of inlining it.
> |  
> |  It can not be changed to loop because it tests
> |  __builtin_constant_p() part of ilog2().  If all these inline tests
> |  passed, ATF_TC_BODY(ilog2_const, tc) is compiled into
> 
> Ah, ok. Please put a comment to that effect.

Ok, I'll add a comment as following:

--- t_bitops.c.ORG	2015-03-18 23:31:26.000000000 +0900
+++ t_bitops.c	2015-03-18 23:32:55.000000000 +0900
@@ -216,6 +216,10 @@
 
 ATF_TC_BODY(ilog2_const, tc)
 {
+	/*
+	 * These inlines test __builtin_constant_p() part of ilog2()
+	 * at compile time, so don't change it to loop.  PR lib/49745
+	 */
 	ATF_REQUIRE(ilog2(0x0000000000000001ULL) == 0);
 	ATF_REQUIRE(ilog2(0x0000000000000002ULL) == 1);
 	ATF_REQUIRE(ilog2(0x0000000000000004ULL) == 2);

---
Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>


Home | Main Index | Thread Index | Old Index