FreeBSD/contrib/ntp/sntp/utilities.c
/* Output a long floating point value in binary in the style described above
 */
Output a long floating point value in binary in the style described above
Output a long floating point value in binary in the style described above
void 
l_fp_output_bin (
		l_fp *ts,
		FILE *output
		)
{
	register int a, b;
	fprintf(output, HLINE);
	for(a=0; a<8; a++) {
		short tmp = ((unsigned char *) ts)[a];
		tmp++;
		fprintf(output, "%i: ", a);
		for(b=7; b>=0; b--) {
			int texp = (int) pow(2, b);
			if(tmp - texp > 0) {
				fprintf(output, "1");
				tmp -= texp;
			}
			else {
				fprintf(output, "0");
			}
		}
		fprintf(output, " ");
	}
	fprintf(output, "\n");
	fprintf(output, HLINE);
}
void l_fp_output_bin ( l_fp * ts , FILE * output ) { register int a , b ; fprintf ( output , HLINE ) ; for ( a = 0 ; a < 8 ; a ++ ) { short tmp = ( ( unsigned char * ) ts ) [ a ] ; tmp ++ ; fprintf ( output , " " , a ) ; for ( b = 7 ; b >= 0 ; b -- ) { int texp = ( int ) pow ( 2 , b ) ; if ( tmp - texp > 0 ) { fprintf ( output , " " ) ; tmp -= texp ; } else { fprintf ( output , " " ) ; } } fprintf ( output , " " ) ; } fprintf ( output , " \n " ) ; fprintf ( output , HLINE ) ; }
Output a long floating point value in binary in the style described above
Output a long floating point value in binary in the style described above