Newer
Older
mbed-os / components / TARGET_PSA / TARGET_TFM / COMPONENT_SPE / secure_fw / core / ipc / tfm_utils.c
@Michael Schwarcz Michael Schwarcz on 19 Feb 2019 478 bytes [trusted-firmware-m]: Updated to 45e5276
/*
 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */
#include <inttypes.h>
#include <stdio.h>
#include "tfm_utils.h"

void tfm_panic(void)
{
    while (1)
        ;
}

int32_t tfm_bitcount(uint32_t n)
{
    int32_t count = 0;
    uint8_t tmp;

    while (n) {
        tmp = n & 0xFF;
        while (tmp) {
            count += tmp & 0x1;
            tmp >>= 1;
        }
        n >>= 8;
    }

    return count;
}