OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "arch_GOARCH.h" | 6 #include "arch_GOARCH.h" |
7 | 7 |
8 enum { | 8 enum { |
9 maxround = sizeof(uintptr), | 9 maxround = sizeof(uintptr), |
10 }; | 10 }; |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 int8* name; | 386 int8* name; |
387 int32* value; | 387 int32* value; |
388 } dbgvar[] = { | 388 } dbgvar[] = { |
389 {"gctrace", &runtime·debug.gctrace}, | 389 {"gctrace", &runtime·debug.gctrace}, |
390 }; | 390 }; |
391 | 391 |
392 void | 392 void |
393 runtime·parsedebugvars(void) | 393 runtime·parsedebugvars(void) |
394 { | 394 { |
395 byte *p; | 395 byte *p; |
396 » int32 i, n; | 396 » intgo i, n; |
397 | 397 |
398 p = runtime·getenv("GODEBUG"); | 398 p = runtime·getenv("GODEBUG"); |
399 if(p == nil) | 399 if(p == nil) |
400 return; | 400 return; |
401 for(;;) { | 401 for(;;) { |
402 for(i=0; i<nelem(dbgvar); i++) { | 402 for(i=0; i<nelem(dbgvar); i++) { |
403 n = runtime·findnull((byte*)dbgvar[i].name); | 403 n = runtime·findnull((byte*)dbgvar[i].name); |
404 if(runtime·mcmp(p, (byte*)dbgvar[i].name, n) == 0 && p[n
] == '=') | 404 if(runtime·mcmp(p, (byte*)dbgvar[i].name, n) == 0 && p[n
] == '=') |
405 *dbgvar[i].value = runtime·atoi(p+n+1); | 405 *dbgvar[i].value = runtime·atoi(p+n+1); |
406 } | 406 } |
(...skipping 23 matching lines...) Expand all Loading... |
430 for(bit = 30; bit >= 0; bit--) { | 430 for(bit = 30; bit >= 0; bit--) { |
431 if(v >= ((int64)div<<bit)) { | 431 if(v >= ((int64)div<<bit)) { |
432 v = v - ((int64)div<<bit); | 432 v = v - ((int64)div<<bit); |
433 res += 1<<bit; | 433 res += 1<<bit; |
434 } | 434 } |
435 } | 435 } |
436 if(rem != nil) | 436 if(rem != nil) |
437 *rem = v; | 437 *rem = v; |
438 return res; | 438 return res; |
439 } | 439 } |
OLD | NEW |