Changeset 10533 in ntrip for trunk/BNC/src/bncutils.h
- Timestamp:
- Sep 17, 2024, 4:55:28 PM (8 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncutils.h
r10330 r10533 171 171 int bitExtracted(int number, int k, int p); 172 172 173 // RTCM3 GPS EPH encoding174 //////////////////////////////////////////////////////////175 #define GPSTOINT(type, value) static_cast<type>(round(value))176 177 #define GPSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \178 |(GPSTOINT(long long,b)&((1ULL<<a)-1)); \179 numbits += (a); \180 while(numbits >= 8) { \181 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}182 183 #define GPSADDBITSFLOAT(a,b,c) {long long i = GPSTOINT(long long,(b)/(c)); \184 GPSADDBITS(a,i)};185 186 // RTCM3 GLONASS EPH encoding187 //////////////////////////////////////////////////////////188 #define GLONASSTOINT(type, value) static_cast<type>(round(value))189 #define GLONASSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \190 |(GLONASSTOINT(long long,b)&((1ULL<<(a))-1)); \191 numbits += (a); \192 while(numbits >= 8) { \193 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}194 #define GLONASSADDBITSFLOATM(a,b,c) {int s; long long i; \195 if(b < 0.0) \196 { \197 s = 1; \198 i = GLONASSTOINT(long long,(-b)/(c)); \199 if(!i) s = 0; \200 } \201 else \202 { \203 s = 0; \204 i = GLONASSTOINT(long long,(b)/(c)); \205 } \206 GLONASSADDBITS(1,s) \207 GLONASSADDBITS(a-1,i)}208 209 // RTCM3 Galileo EPH encoding210 //////////////////////////////////////////////////////////211 #define GALILEOTOINT(type, value) static_cast<type>(round(value))212 #define GALILEOADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \213 |(GALILEOTOINT(long long,b)&((1LL<<a)-1)); \214 numbits += (a); \215 while(numbits >= 8) { \216 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}217 #define GALILEOADDBITSFLOAT(a,b,c) {long long i = GALILEOTOINT(long long,(b)/(c)); \218 GALILEOADDBITS(a,i)};219 220 // RTCM3 SBAS EPH encoding221 //////////////////////////////////////////////////////////222 #define SBASTOINT(type, value) static_cast<type>(round(value))223 #define SBASADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \224 |(SBASTOINT(long long,b)&((1ULL<<a)-1)); \225 numbits += (a); \226 while(numbits >= 8) { \227 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}228 #define SBASADDBITSFLOAT(a,b,c) {long long i = SBASTOINT(long long,(b)/(c)); \229 SBASADDBITS(a,i)};230 231 // RTCM3 BDS EPH encoding232 //////////////////////////////////////////////////////////233 #define BDSTOINT(type, value) static_cast<type>(round(value))234 #define BDSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \235 |(BDSTOINT(long long,b)&((1ULL<<a)-1)); \236 numbits += (a); \237 while(numbits >= 8) { \238 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}239 #define BDSADDBITSFLOAT(a,b,c) {long long i = BDSTOINT(long long,(b)/(c)); \240 BDSADDBITS(a,i)};241 173 242 174 #endif
Note:
See TracChangeset
for help on using the changeset viewer.