Print this page
11210 libm should be cstyle(1ONBLD) clean

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libm/common/m9x/fex_handler.c
          +++ new/usr/src/lib/libm/common/m9x/fex_handler.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
       25 +
  25   26  /*
  26   27   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27   28   * Use is subject to license terms.
  28   29   */
  29   30  
  30   31  #pragma weak __fex_get_handling = fex_get_handling
  31   32  #pragma weak __fex_set_handling = fex_set_handling
  32   33  #pragma weak __fex_getexcepthandler = fex_getexcepthandler
  33   34  #pragma weak __fex_setexcepthandler = fex_setexcepthandler
  34   35  
  35   36  #include <fenv.h>
  36   37  #include <ucontext.h>
  37   38  #include <thread.h>
  38   39  #include "fex_handler.h"
  39   40  
  40      -int fex_get_handling(int e)
       41 +int
       42 +fex_get_handling(int e)
  41   43  {
  42      -        struct fex_handler_data *thr_handlers;
  43      -        int                                             i;
       44 +        struct fex_handler_data *thr_handlers;
       45 +        int i;
  44   46  
  45   47          thr_handlers = __fex_get_thr_handlers();
       48 +
  46   49          for (i = 0; i < FEX_NUM_EXC; i++)
  47   50                  if (e & (1 << i))
  48      -                        return thr_handlers[i].__mode;
  49      -        return FEX_NOHANDLER;
       51 +                        return (thr_handlers[i].__mode);
       52 +
       53 +        return (FEX_NOHANDLER);
  50   54  }
  51   55  
  52      -int fex_set_handling(int e, int mode, void (*handler)())
       56 +int
       57 +fex_set_handling(int e, int mode, void (*handler)())
  53   58  {
  54      -        struct fex_handler_data *thr_handlers;
  55      -        int                                             i;
       59 +        struct fex_handler_data *thr_handlers;
       60 +        int i;
  56   61  
  57   62          if (e & ~((1 << FEX_NUM_EXC) - 1))
  58      -                return 0;
       63 +                return (0);
       64 +
  59   65          thr_handlers = __fex_get_thr_handlers();
       66 +
  60   67          for (i = 0; i < FEX_NUM_EXC; i++) {
  61   68                  if (e & (1 << i)) {
  62   69                          thr_handlers[i].__mode = mode;
  63   70                          thr_handlers[i].__handler = handler;
  64   71                  }
  65   72          }
       73 +
  66   74          __fex_update_te();
  67      -        return 1;
       75 +        return (1);
  68   76  }
  69   77  
  70      -void fex_getexcepthandler(fex_handler_t *buf, int e)
       78 +void
       79 +fex_getexcepthandler(fex_handler_t *buf, int e)
  71   80  {
  72      -        struct fex_handler_data *thr_handlers;
  73      -        int                                             i;
       81 +        struct fex_handler_data *thr_handlers;
       82 +        int i;
  74   83  
  75   84          thr_handlers = __fex_get_thr_handlers();
       85 +
  76   86          for (i = 0; i < FEX_NUM_EXC; i++)
  77   87                  if (e & (1 << i))
  78   88                          (*buf)[i] = thr_handlers[i];
  79   89  }
  80   90  
  81      -void fex_setexcepthandler(const fex_handler_t *buf, int e)
       91 +void
       92 +fex_setexcepthandler(const fex_handler_t *buf, int e)
  82   93  {
  83      -        struct fex_handler_data *thr_handlers;
  84      -        int                                             i;
       94 +        struct fex_handler_data *thr_handlers;
       95 +        int i;
  85   96  
  86   97          thr_handlers = __fex_get_thr_handlers();
       98 +
  87   99          for (i = 0; i < FEX_NUM_EXC; i++)
  88  100                  if (e & (1 << i))
  89  101                          thr_handlers[i] = (*buf)[i];
      102 +
  90  103          __fex_update_te();
  91  104  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX