示例#1
0
文件: fesetmode.c 项目: kraj/glibc
int
fesetmode (const femode_t *modep)
{
  fenv_union_t u;

  u.fenv = *modep;
  __sim_round_mode_thread = u.l[0];
  SIM_SET_GLOBAL (__sim_round_mode_global, __sim_round_mode_thread);
  __sim_disabled_exceptions_thread = u.l[1];
  SIM_SET_GLOBAL (__sim_disabled_exceptions_global,
		  __sim_disabled_exceptions_thread);
  return 0;
}
示例#2
0
文件: sim-full.c 项目: AubrCool/glibc
void
__simulate_exceptions (int x)
{
  __sim_exceptions_thread |= x;
  SIM_SET_GLOBAL (__sim_exceptions_global, __sim_exceptions_thread);
  if (x & ~__sim_disabled_exceptions_thread)
    raise (SIGFPE);
}
示例#3
0
int
__feraiseexcept (int x)
{
  __sim_exceptions_thread |= x;
  SIM_SET_GLOBAL (__sim_exceptions_global, __sim_exceptions_thread);
  if (x & ~__sim_disabled_exceptions_thread)
    raise (SIGFPE);
  return 0;
}
示例#4
0
int
__fesetexceptflag(const fexcept_t *flagp, int excepts)
{
  /* Ignore exceptions not listed in 'excepts'.  */
  __sim_exceptions_thread
    = (__sim_exceptions_thread & ~excepts) | (*flagp & excepts);
  SIM_SET_GLOBAL (__sim_exceptions_global, __sim_exceptions_thread);

  return 0;
}
示例#5
0
int
feenableexcept (int exceptions)
{
  int old_exceptions = ~__sim_disabled_exceptions_thread & FE_ALL_EXCEPT;

  __sim_disabled_exceptions_thread &= ~exceptions;
  SIM_SET_GLOBAL (__sim_disabled_exceptions_global,
		  __sim_disabled_exceptions_thread);

  return old_exceptions;
}
示例#6
0
int
__feupdateenv (const fenv_t *envp)
{
  int saved_exceptions;

  /* Save currently set exceptions.  */
  saved_exceptions = __sim_exceptions_thread;

  /* Set environment.  */
  __fesetenv (envp);

  /* Raise old exceptions.  */
  __sim_exceptions_thread |= saved_exceptions;
  SIM_SET_GLOBAL (__sim_exceptions_global, __sim_exceptions_thread);
  if (saved_exceptions & ~__sim_disabled_exceptions_thread)
    raise (SIGFPE);

  return 0;
}