patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Aaron Conole <>
To: David Marchand <>
Subject: Re: [dpdk-stable] [PATCH] test/common: fix log2 check
Date: Wed, 04 Dec 2019 16:19:56 -0500
Message-ID: <> (raw)
In-Reply-To: <> (David Marchand's message of "Wed, 4 Dec 2019 21:52:41 +0100")

David Marchand <> writes:

> We recently started to get random failures on the common_autotest ut with
> clang on Ubuntu 16.04.6.
> Example:
> Wrong rte_log2_u64(0) val 0, expected ffffffff
> Test Failed
> The ut passes 0 to log2() to get an expected value.
> Quoting log2 / log(3) manual:
> If x is zero, then a pole error occurs, and the functions return
> -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively.
> rte_log2_uXX helpers handle 0 as a special value and return 0.
> Let's have dedicated tests for this case.
> Fixes: 05c4345ef5c2 ("test: add unit test for integer log2 function")
> Cc:
> Signed-off-by: David Marchand <>
> ---

Acked-by: Aaron Conole <>

Somethings that concern me:

1.  A log2(0) should probably be an undetermined value, but this
    effectively makes log2(0) == log2(1) so that if anyone uses these
    for some mathematical work, it will have an exceptional behavior.  I
    know it's documented from a programmer perspective, but I am all for
    documenting the mathematical side effect as well.

2.  Why hasn't this been complaining for so long?  Or has it and we just
    haven't noticed?  Were some compiler flags changed recently? (maybe
    -funsafe-math was always set or something?)


  reply	other threads:[~2019-12-04 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 20:52 David Marchand
2019-12-04 21:19 ` Aaron Conole [this message]
2019-12-05  8:31   ` David Marchand
2019-12-05 14:39     ` Aaron Conole
2019-12-20 14:01 ` [dpdk-stable] [PATCH v2] " David Marchand
2019-12-20 14:06   ` David Marchand
2019-12-20 14:43   ` David Marchand
2019-12-20 14:52     ` Aaron Conole

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ \
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone