util/bufferiszero: Reorganize for early test for acceleration
commitcbe3d5264631aa193fd2705820cbde6c5a602abb
authorAlexander Monakov <amonakov@ispras.ru>
Tue, 6 Feb 2024 20:48:05 +0000 (6 23:48 +0300)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 3 May 2024 15:03:05 +0000 (3 08:03 -0700)
tree8d7c64e91e3b1e7d595c0987a4453419e922ff70
parentd018425c324704949c7f65230def9586e71f07f5
util/bufferiszero: Reorganize for early test for acceleration

Test for length >= 256 inline, where is is often a constant.
Before calling into the accelerated routine, sample three bytes
from the buffer, which handles most non-zero buffers.

Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Signed-off-by: Mikhail Romanov <mmromanov@ispras.ru>
Message-Id: <20240206204809.9859-3-amonakov@ispras.ru>
[rth: Use __builtin_constant_p; move the indirect call out of line.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
include/qemu/cutils.h
util/bufferiszero.c