mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 13:05:03 +08:00
ea65cc9bfb
Based on 1 normalized pattern(s): this program is free software you can distribute it and or modify it under the terms of the gnu general public license as published by the free software foundation version 2 of the license extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 8 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Enrico Weigelt <info@metux.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081201.231815901@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
53 lines
974 B
C
53 lines
974 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* IEEE754 floating point arithmetic
|
|
* double precision: CLASS.f
|
|
* FPR[fd] = class(FPR[fs])
|
|
*
|
|
* MIPS floating point support
|
|
* Copyright (C) 2015 Imagination Technologies, Ltd.
|
|
* Author: Markos Chandras <markos.chandras@imgtec.com>
|
|
*/
|
|
|
|
#include "ieee754dp.h"
|
|
|
|
int ieee754dp_2008class(union ieee754dp x)
|
|
{
|
|
COMPXDP;
|
|
|
|
EXPLODEXDP;
|
|
|
|
/*
|
|
* 10 bit mask as follows:
|
|
*
|
|
* bit0 = SNAN
|
|
* bit1 = QNAN
|
|
* bit2 = -INF
|
|
* bit3 = -NORM
|
|
* bit4 = -DNORM
|
|
* bit5 = -ZERO
|
|
* bit6 = INF
|
|
* bit7 = NORM
|
|
* bit8 = DNORM
|
|
* bit9 = ZERO
|
|
*/
|
|
|
|
switch(xc) {
|
|
case IEEE754_CLASS_SNAN:
|
|
return 0x01;
|
|
case IEEE754_CLASS_QNAN:
|
|
return 0x02;
|
|
case IEEE754_CLASS_INF:
|
|
return 0x04 << (xs ? 0 : 4);
|
|
case IEEE754_CLASS_NORM:
|
|
return 0x08 << (xs ? 0 : 4);
|
|
case IEEE754_CLASS_DNORM:
|
|
return 0x10 << (xs ? 0 : 4);
|
|
case IEEE754_CLASS_ZERO:
|
|
return 0x20 << (xs ? 0 : 4);
|
|
default:
|
|
pr_err("Unknown class: %d\n", xc);
|
|
return 0;
|
|
}
|
|
}
|