From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6B48B5A027A for ; Wed, 8 Mar 2023 23:45:16 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4PX6pF6LbYz4xFL; Thu, 9 Mar 2023 09:45:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1678315509; bh=sxxXwpZ6o/Go/06+0S591c/fgXFknlxsjb+dVKveMP0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X54cVZKSknbLmTbzQmR40P/2lEau8m06OZ8s/BVIpdckx13czk4RHLcCXCuR4wLfU CqYVcb76KTWYcwVm+iJjCwzI8NzjkXdlhNWPFNJHFlIbsYuhCtOiWizLMio05aZMW7 MRyPq+HA0VKwaQnVLFV6FSJjcX/zviK3Q8T1A/ho= Date: Thu, 9 Mar 2023 09:11:43 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 4/4] util: Carry own definition of __bswap_constant{16,32} Message-ID: References: <20230308073516.2189680-1-sbrivio@redhat.com> <20230308073516.2189680-5-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cYcYHcw/jbvA8Esa" Content-Disposition: inline In-Reply-To: <20230308073516.2189680-5-sbrivio@redhat.com> Message-ID-Hash: 6HMVE3NUSSJWWEOBDR6LLX36ODCKYILI X-Message-ID-Hash: 6HMVE3NUSSJWWEOBDR6LLX36ODCKYILI X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, Chris Kuhn , lemmi X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --cYcYHcw/jbvA8Esa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 08, 2023 at 08:35:16AM +0100, Stefano Brivio wrote: > musl doesn't define those, use our own definition there. This is a > trivial implementation, similar to what's shipped by e.g. uClibc, > glibc, libiio. >=20 > Reported-by: Chris Kuhn > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > util.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) >=20 > diff --git a/util.h b/util.h > index 570094c..8367f51 100644 > --- a/util.h > +++ b/util.h > @@ -88,6 +88,17 @@ > #define MAC_ZERO ((uint8_t [ETH_ALEN]){ 0 }) > #define MAC_IS_ZERO(addr) (!memcmp((addr), MAC_ZERO, ETH_ALEN)) > =20 > +#ifndef __bswap_constant_16 > +#define __bswap_constant_16(x) \ > + ((uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) > +#endif > + > +#ifndef __bswap_constant_32 > +#define __bswap_constant_32(x) \ > + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ > + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) > +#endif > + > #if __BYTE_ORDER =3D=3D __BIG_ENDIAN > #define htons_constant(x) (x) > #define htonl_constant(x) (x) --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --cYcYHcw/jbvA8Esa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmQJCBkACgkQzQJF27ox 2Gft5Q/7BNAc9bYVL8zzpqRGDKxRK6UeUwTO7v9Abp2W731CRmM5HpURQ4x9ahPd F/HJ08pwTwY/5azXAW1sOhQ/YhKNY7O6joGAessVpSc0uFi4g6d/QbjZE7DQRwHM lhlF8Kkb9I+57TnJzy60H0w0PxyBdDybeZuDUGNFr+PDi8xw4vE8p8Zg8nhMBDpP nhso0jNhLIbMOuwZiQif5dJXBtgcQZxM79yAizsbDgwTHLxyTY0aMwOlHcmUsTB7 Y26CT0Ax0sv37D1I8gJyvTklHJEH6LPL7WHVdADApE28YIagaUQBxDQk5XZJRiDr wc3auKAhbyrqur7fZYhKITmLPiz3YMF4l0DVZUKJduxKbbXHINpOXDix541Ljyqu vGgWo0Q5jC3ngRGQan9StiqBJ0xi9n7gq6fvN43paJVYEKR4RAeaw2eSw/PB/R9u LaHDY/040opKmqcJwW3XaER6RW41gspYdhiTcm2EXz7Rd9e/LjZTeAJ4RhFJ8Nhr 4WIsSVadOKEze6GdiQJ7JumTDzCgBa5zWjjFX/l/pg2SARKxt2NxPwSTvMIcO07j E/PMpc/6aK+ooYZIUoPxibAN/sMpjsuOPg1XSB8T9/NlQNh3NhL07iEIe2rrAF4F bLhAptN9eDM4vVdi3bS5EPHxU7n0yyU5FqTKvPsSqgaamikHGtk= =jD/K -----END PGP SIGNATURE----- --cYcYHcw/jbvA8Esa--