summaryrefslogtreecommitdiff
path: root/core/cortex-m0/__builtin.c
blob: 8e2bf984ffc8f41b7dfdc72c2960fab6edcdc834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Copyright 2019 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "common.h"

/*
 * __builtin_ffs:
 * Returns one plus the index of the least significant 1-bit of x,
 * or if x is zero, returns zero.
 */
int __keep __ffssi2(int x)
{
	return 32 - __builtin_clz(x & -x);
}