bitfield.h (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) | bitfield.h (bb4a0c88ae3108209c6a7144ccd0b456856cf316) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/**************************************************************************** 3 * Driver for Solarflare network controllers and boards 4 * Copyright 2005-2006 Fen Systems Ltd. 5 * Copyright 2006-2013 Solarflare Communications Inc. 6 */ 7 8#ifndef EF4_BITFIELD_H --- 103 unchanged lines hidden (view full) --- 112 * For example, suppose "element" represents the high 32 bits of a 113 * 64-bit value, and we wish to extract the bits belonging to the bit 114 * field occupying bits 28-45 of this 64-bit value. 115 * 116 * Then EF4_EXTRACT ( element, 32, 63, 28, 45 ) would give 117 * 118 * ( element ) << 4 119 * | 1/* SPDX-License-Identifier: GPL-2.0-only */ 2/**************************************************************************** 3 * Driver for Solarflare network controllers and boards 4 * Copyright 2005-2006 Fen Systems Ltd. 5 * Copyright 2006-2013 Solarflare Communications Inc. 6 */ 7 8#ifndef EF4_BITFIELD_H --- 103 unchanged lines hidden (view full) --- 112 * For example, suppose "element" represents the high 32 bits of a 113 * 64-bit value, and we wish to extract the bits belonging to the bit 114 * field occupying bits 28-45 of this 64-bit value. 115 * 116 * Then EF4_EXTRACT ( element, 32, 63, 28, 45 ) would give 117 * 118 * ( element ) << 4 119 * |
120 * The result will contain the relevant bits filled in in the range | 120 * The result will contain the relevant bits filled in the range |
121 * [0,high-low), with garbage in bits [high-low+1,...). 122 */ 123#define EF4_EXTRACT_NATIVE(native_element, min, max, low, high) \ 124 ((low) > (max) || (high) < (min) ? 0 : \ 125 (low) > (min) ? \ 126 (native_element) >> ((low) - (min)) : \ 127 (native_element) << ((min) - (low))) 128 --- 411 unchanged lines hidden --- | 121 * [0,high-low), with garbage in bits [high-low+1,...). 122 */ 123#define EF4_EXTRACT_NATIVE(native_element, min, max, low, high) \ 124 ((low) > (max) || (high) < (min) ? 0 : \ 125 (low) > (min) ? \ 126 (native_element) >> ((low) - (min)) : \ 127 (native_element) << ((min) - (low))) 128 --- 411 unchanged lines hidden --- |