/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * include/asm-xtensa/swab.h * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2001 - 2005 Tensilica Inc.
*/
staticinline __attribute_const__ __u16 __arch_swab16(__u16 x)
{ /* Given that 'short' values are signed (i.e., can be negative), * we cannot assume that the upper 16-bits of the register are * zero. We are careful to mask values after shifting.
*/
/* There exists an anomaly between xt-gcc and xt-xcc. xt-gcc * inserts an extui instruction after putting this function inline * to ensure that it uses only the least-significant 16 bits of * the result. xt-xcc doesn't use an extui, but assumes the * __asm__ macro follows convention that the upper 16 bits of an * 'unsigned short' result are still zero. This macro doesn't * follow convention; indeed, it leaves garbage in the upport 16 * bits of the register.
* Declaring the temporary variables 'res' and 'tmp' to be 32-bit * types while the return type of the function is a 16-bit type * forces both compilers to insert exactly one extui instruction
* (or equivalent) to mask off the upper 16 bits. */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.