From: idgay Date: Sat, 20 Sep 2008 00:10:18 +0000 (+0000) Subject: nx_float support X-Git-Tag: rc_6_tinyos_2_1_1~614 X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=cdf278b6057cacffcbf1940bd8fed63cb23c9242;p=tinyos-2.x.git nx_float support --- diff --git a/tos/chips/atm128/atm128hardware.h b/tos/chips/atm128/atm128hardware.h index 32c1c8e3..b412d90f 100644 --- a/tos/chips/atm128/atm128hardware.h +++ b/tos/chips/atm128/atm128hardware.h @@ -135,7 +135,12 @@ mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2) @safe() { return (m1 < m2)? m1: m2; } -/* Floating-point network-type support */ +/* Floating-point network-type support. + These functions must convert to/from a 32-bit big-endian integer that follows + the layout of Java's java.lang.float.floatToRawIntBits method. + Conveniently, for the AVR family, this is a straight byte copy... +*/ + typedef float nx_float __attribute__((nx_base_be(afloat))); inline float __nesc_ntoh_afloat(const void *COUNT(sizeof(float)) source) @safe() { diff --git a/tos/chips/msp430/msp430hardware.h b/tos/chips/msp430/msp430hardware.h index 829f2bd8..ac18b26c 100644 --- a/tos/chips/msp430/msp430hardware.h +++ b/tos/chips/msp430/msp430hardware.h @@ -239,7 +239,12 @@ void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts) @spontaneous() @safe } #endif -/* Floating-point network-type support */ +/* Floating-point network-type support. + These functions must convert to/from a 32-bit big-endian integer that follows + the layout of Java's java.lang.float.floatToRawIntBits method. + Conveniently, for the MSP430 family, this is a straight byte copy... +*/ + typedef float nx_float __attribute__((nx_base_be(afloat))); inline float __nesc_ntoh_afloat(const void *COUNT(sizeof(float)) source) @safe() {