/* * Copyright (C) 2016 Eistec AB * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup cpu * @{ * * @file * @brief MSPGCC supplemental functions * * @author Joakim NohlgÄrd >= 1) { if (x & mask) { return i; } ++i; } return i; /* returns 16 if x == 0 */ } /** * @brief Count trailing zeros * * Naive implementation */ int __ctzhi2(UHItype x) { int i = 0; for (UHItype mask = 1; mask != 0; mask <<= 1) { if (x & mask) { return i; } ++i; } return i; /* returns 16 if x == 0 */ } #endif /* __MSPGCC__ */