ffs() is in <strings.h> although bsd compatible systems have it in
<string.h> already. ffs() is used in omap1.c, omap2.c, omap_i2c.c,
bt-sdp.c. These uses can be replaced with clz32() but ffs is more
available. Problem was spotted by malc.
Make host-utils.h formatting more consistent.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5708
c046a42c-6fe2-441c-8c8c-
71466251a162
-static always_inline int ctz32 (uint32_t val)
+static always_inline int ctz32(uint32_t val)
{
#if QEMU_GNUC_PREREQ(3, 4)
if (val)
{
#if QEMU_GNUC_PREREQ(3, 4)
if (val)
cnt = 0;
if (!(val & 0x0000FFFFUL)) {
cnt = 0;
if (!(val & 0x0000FFFFUL)) {
if (!(val & 0x000000FFUL)) {
if (!(val & 0x000000FFUL)) {
if (!(val & 0x0000000FUL)) {
if (!(val & 0x0000000FUL)) {
if (!(val & 0x00000003UL)) {
if (!(val & 0x00000003UL)) {
if (!(val & 0x00000001UL)) {
if (!(val & 0x00000001UL)) {
if (!(val & 0x00000001UL)) {
if (!(val & 0x00000001UL)) {
- }
-
-static always_inline int cto32 (uint32_t val)
- {
+}
+
+static always_inline int cto32(uint32_t val)
+{
-static always_inline int ctz64 (uint64_t val)
+static always_inline int ctz64(uint64_t val)
{
#if QEMU_GNUC_PREREQ(3, 4)
if (val)
{
#if QEMU_GNUC_PREREQ(3, 4)
if (val)
-static always_inline int cto64 (uint64_t val)
+static always_inline int cto64(uint64_t val)
-static always_inline int ctpop8 (uint8_t val)
+static always_inline int ctpop8(uint8_t val)
{
val = (val & 0x55) + ((val >> 1) & 0x55);
val = (val & 0x33) + ((val >> 2) & 0x33);
{
val = (val & 0x55) + ((val >> 1) & 0x55);
val = (val & 0x33) + ((val >> 2) & 0x33);
-static always_inline int ctpop16 (uint16_t val)
+static always_inline int ctpop16(uint16_t val)
{
val = (val & 0x5555) + ((val >> 1) & 0x5555);
val = (val & 0x3333) + ((val >> 2) & 0x3333);
{
val = (val & 0x5555) + ((val >> 1) & 0x5555);
val = (val & 0x3333) + ((val >> 2) & 0x3333);
-static always_inline int ctpop32 (uint32_t val)
+static always_inline int ctpop32(uint32_t val)
{
#if QEMU_GNUC_PREREQ(3, 4)
return __builtin_popcount(val);
{
#if QEMU_GNUC_PREREQ(3, 4)
return __builtin_popcount(val);
-static always_inline int ctpop64 (uint64_t val)
+static always_inline int ctpop64(uint64_t val)
{
#if QEMU_GNUC_PREREQ(3, 4)
return __builtin_popcountll(val);
{
#if QEMU_GNUC_PREREQ(3, 4)
return __builtin_popcountll(val);
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <inttypes.h>
#include <limits.h>
#include <time.h>
#include <inttypes.h>
#include <limits.h>
#include <time.h>