Index: trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 10902)
+++ trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 10903)
@@ -1705,5 +1705,4 @@
     eph._inav = (i == 1046);
     eph._fnav = (i == 1045);
-    int mnum = i;
     GETBITS(i, 6)
     if (i < 1 || i > 36 ) { // max. constellation within I/NAV / F/NAV frames is 36
Index: trunk/BNC/src/RTCM3/bits.h
===================================================================
--- trunk/BNC/src/RTCM3/bits.h	(revision 10902)
+++ trunk/BNC/src/RTCM3/bits.h	(revision 10903)
@@ -156,5 +156,5 @@
 // RTCM3 CRS encoding
 //////////////////////////////////////////////////////////
-#define CRSTOINT(type, value) static_cast<type>(ceil(value))
+#define CRSTOINT(type, value) static_cast<type>(round(value))
 
 #define CRSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
@@ -169,5 +169,5 @@
 // RTCM3 GPS EPH encoding
 //////////////////////////////////////////////////////////
-#define GPSTOINT(type, value) static_cast<type>(ceil(value))
+#define GPSTOINT(type, value) static_cast<type>(round(value))
 
 #define GPSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
@@ -182,5 +182,5 @@
 // RTCM3 GLONASS EPH encoding
 //////////////////////////////////////////////////////////
-#define GLONASSTOINT(type, value) static_cast<type>(ceil(value))
+#define GLONASSTOINT(type, value) static_cast<type>(round(value))
 
 #define GLONASSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
@@ -207,5 +207,5 @@
 // RTCM3 Galileo EPH encoding
 //////////////////////////////////////////////////////////
-#define GALILEOTOINT(type, value) static_cast<type>(ceil(value))
+#define GALILEOTOINT(type, value) static_cast<type>(round(value))
 
 #define GALILEOADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
@@ -220,5 +220,5 @@
 // RTCM3 BDS EPH encoding
 //////////////////////////////////////////////////////////
-#define BDSTOINT(type, value) static_cast<type>(ceil(value))
+#define BDSTOINT(type, value) static_cast<type>(round(value))
 
 #define BDSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
@@ -233,5 +233,5 @@
 // RTCM3 SBAS EPH encoding
 //////////////////////////////////////////////////////////
-#define SBASTOINT(type, value) static_cast<type>(ceil(value))
+#define SBASTOINT(type, value) static_cast<type>(round(value))
 
 #define SBASADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
Index: trunk/BNC/src/RTCM3/ephEncoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/ephEncoder.cpp	(revision 10902)
+++ trunk/BNC/src/RTCM3/ephEncoder.cpp	(revision 10903)
@@ -26,5 +26,5 @@
     GPSADDBITSFLOAT(16, eph._clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<13))
     GPSADDBITSFLOAT(22, eph._clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
-    GPSADDBITS(8, eph._IODE)
+    GPSADDBITS(8, static_cast<int>(eph._IODE))
     GPSADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
     GPSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
@@ -63,5 +63,5 @@
     GPSADDBITSFLOAT(8, eph._TGD, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
     GPSADDBITSFLOAT(22, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<11))
-    GPSADDBITS(8, eph._IODE) // Issue Of Data Ephemeris and Clock
+    GPSADDBITS(8, static_cast<int>(eph._IODE)) // Issue Of Data Ephemeris and Clock
     GPSADDBITS(10, 0) /* padding */
     if        (eph._health == 0.0) {
@@ -95,6 +95,7 @@
     GPSADDBITSFLOAT(22, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<11))
     GPSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
-    GPSADDBITS(2, static_cast<int> (eph._s_bits_after_IDOT))
-    GPSADDBITS(2, static_cast<int> (eph._s_bits_after_i0))
+    GPSADDBITS(2, static_cast<int>(eph._s_bits_after_IDOT))
+    GPSADDBITS(2, static_cast<int>(eph._s_bits_after_i0))
+    GPSADDBITS(6, 0) /* padding */
   } else {
     GPSADDBITS(12, 1019)
@@ -104,5 +105,5 @@
     GPSADDBITS(2,eph._L2Codes)
     GPSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
-    GPSADDBITS(8, eph._IODE)
+    GPSADDBITS(8, static_cast<int>(eph._IODE))
     GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
     GPSADDBITSFLOAT(8, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<25))
