From: <jbe...@co...> - 2006-05-25 18:48:14
|
Author: jbenedik Date: Thu May 25 20:49:03 2006 New Revision: 27683 Modified: psyco/branch/nfs/c/Objects/pfloatobject.c psyco/branch/nfs/c/Objects/pfloatobject.h Log: Adding float_from_int. Modified: psyco/branch/nfs/c/Objects/pfloatobject.c ============================================================================== --- psyco/branch/nfs/c/Objects/pfloatobject.c (original) +++ psyco/branch/nfs/c/Objects/pfloatobject.c Thu May 25 20:49:03 2006 @@ -192,6 +192,28 @@ *result = value; } +DEFINEFN +vinfo_t* PsycoFloat_FromLong(PsycoObject* po, vinfo_t* vobj) +{ + if (Psyco_VerifyType(po, vobj, &PyInt_Type) != true) { + return NULL; + } + + vinfo_t* vlong = PsycoInt_AS_LONG(po, vobj); + if (vlong == NULL) { + return NULL; + } + + vinfo_t* x; + vinfo_array_t* result = array_new(2); + x = psyco_generic_call(po, cimpl_fp_from_long, CfNoReturnValue|CfPure, + "va", vlong, result); + if (x != NULL) { + x = PsycoFloat_FROM_DOUBLE(result->items[0], result->items[1]); + } + array_release(result); + return x; +} DEFINEFN vinfo_t* PsycoFloat_FromFloat(PsycoObject* po, vinfo_t* vfloat) Modified: psyco/branch/nfs/c/Objects/pfloatobject.h ============================================================================== --- psyco/branch/nfs/c/Objects/pfloatobject.h (original) +++ psyco/branch/nfs/c/Objects/pfloatobject.h Thu May 25 20:49:03 2006 @@ -45,6 +45,8 @@ return PsycoFloat_FROM_DOUBLE(vdouble1, vdouble2); } +EXTERNFN vinfo_t* PsycoFloat_FromLong(PsycoObject* po, vinfo_t* vlong); + EXTERNFN vinfo_t* PsycoFloat_FromFloat(PsycoObject* po, vinfo_t* vfloat); PSY_INLINE vinfo_t* PsycoFloat_AS_DOUBLE_1(PsycoObject* po, vinfo_t* v) |