Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

pfpu command: print results always as hex dump and as floats

Before, main_pfpu tried to be a bit too smart and made the output
format follow the input format. More often than not, this turned
out to be inconvenient. Now we just print both - let the user
sort them out.
  • Loading branch information...
commit 57592ac11e6bb0a3fc5772eb76a806fbfe7685ba 1 parent 73bc649
Werner Almesberger authored January 15, 2012

Showing 1 changed file with 2 additions and 8 deletions. Show diff stats Hide diff stats

  1. 10  src/shellext.c
10  src/shellext.c
@@ -179,7 +179,6 @@ static int main_pfpu(int argc, char **argv)
179 179
 	};
180 180
 	char **arg;
181 181
 	float *r = regs+PFPU_SPREG_COUNT, *rr;
182  
-	int hex = 0;
183 182
 	int fd, res;
184 183
 
185 184
 	for(arg = argv+1; arg != argv+argc; arg++) {
@@ -188,7 +187,6 @@ static int main_pfpu(int argc, char **argv)
188 187
 		} else if(!strncmp(*arg, "0x", 2)) {
189 188
 			u.i = strtoul(*arg, NULL, 0);
190 189
 			*r++ = u.f;
191  
-			hex = 1;
192 190
 		} else if(strlen(*arg) == 8) {
193 191
 			program[td.progsize++] = strtoul(*arg, NULL, 16);
194 192
 		} else {
@@ -213,12 +211,8 @@ static int main_pfpu(int argc, char **argv)
213 211
 	for(rr = regs+PFPU_SPREG_COUNT; r != rr; rr++) {
214 212
 		if(rr != regs+PFPU_SPREG_COUNT)
215 213
 			putchar(' ');
216  
-		if(hex) {
217  
-			u.f = *rr;
218  
-			printf("0x%08x", u.i);
219  
-		} else {
220  
-			printf("%g", *rr);
221  
-		}
  214
+		u.f = *rr;
  215
+		printf("0x%08x %g", u.i, *rr);
222 216
 	}
223 217
 	putchar('\n');
224 218
 

0 notes on commit 57592ac

Please sign in to comment.
Something went wrong with that request. Please try again.