github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/libs/fenv.go (about)

     1  package libs
     2  
     3  import (
     4  	"github.com/gotranspile/cxgo/runtime/cmath"
     5  	"github.com/gotranspile/cxgo/types"
     6  )
     7  
     8  const (
     9  	fenvH = "fenv.h"
    10  )
    11  
    12  func init() {
    13  	RegisterLibrary(fenvH, func(c *Env) *Library {
    14  		gint := c.Go().Int()
    15  		intT := types.IntT(4)
    16  		return &Library{
    17  			Imports: map[string]string{
    18  				"cmath": RuntimePrefix + "cmath",
    19  			},
    20  			Idents: map[string]*types.Ident{
    21  				"FE_TOWARDZERO": c.NewIdent("FE_TOWARDZERO", "cmath.TowardZero", cmath.TowardZero, gint),
    22  				"fesetround":    c.NewIdent("fesetround", "cmath.FSetRound", cmath.FSetRound, c.FuncTT(intT, intT)),
    23  			},
    24  		}
    25  	})
    26  }