hardware_routines.c

来自「nios中自定义指令集实现三角函数的软件部分。」· C语言 代码 · 共 101 行

C
101
字号

unsigned int double_to_uint(double x)
{
    return((unsigned int)(x));
}

int double_to_int(double x)
{
    return((int)(x));
}

double int_to_double(int x)
{
    return((double)(x));
}

double uint_to_double(unsigned int x)
{
    return((double)(x));
}

int double_agtb(double a, double b)
{
    return((a > b) ? (1) : (0));
}

int double_altb(double a, double b)
{
    return((a < b) ? (1) : (0));
}

int double_ageb(double a, double b)
{
    return((a >= b) ? (1) : (0));
}

int double_aleb(double a, double b)
{
    return((a <= b) ? (1) : (0));
}

int double_aeqb(double a, double b)
{
    return((a == b) ? (1) : (0));
}

int double_aneb(double a, double b)
{
    return((a != b) ? (1) : (0));
}

double float_to_double(float x)
{
    return((double)(x));
}

float double_to_float(double x)
{
    return((float)(x));
}

double dpfp_hw_addition(double a, double b)
{
  return(a + b);
}

double dpfp_hw_subtraction(double a, double b)
{
  return(a - b);
}

double dpfp_hw_multiplication(double a, double b)
{
  return(a * b);
}

double dpfp_hw_division(double a, double b)
{
  return(a / b);
}

float spfp_hw_addition(float a, float b)
{
  return(a + b);
}

float spfp_hw_subtraction(float a, float b)
{
  return(a - b);
}

float spfp_hw_multiplication(float a, float b)
{
  return(a * b);
}

float spfp_hw_division(float a, float b)
{
  return(a / b);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?