about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--html/subx/010core.cc.html8
-rw-r--r--subx/010core.cc6
2 files changed, 7 insertions, 7 deletions
diff --git a/html/subx/010core.cc.html b/html/subx/010core.cc.html
index ce74e6e8..606d4dec 100644
--- a/html/subx/010core.cc.html
+++ b/html/subx/010core.cc.html
@@ -155,10 +155,10 @@ if ('onhashchange' in window) {
 <span id="L92" class="LineNr"> 92 </span><span class="Delimiter">}</span>
 <span id="L93" class="LineNr"> 93 </span>
 <span id="L94" class="LineNr"> 94 </span><span class="Normal">void</span> load_program<span class="Delimiter">(</span><span class="Normal">const</span> string&amp; text_bytes<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-<span id="L95" class="LineNr"> 95 </span>  <span class="Comment">// now, to read the hex bytes in ASCII, we'll use C's strtol</span>
-<span id="L96" class="LineNr"> 96 </span>  <span class="Comment">// strtol needs a char*, so we grab the buffer backing the string object</span>
-<span id="L97" class="LineNr"> 97 </span>  <span class="Normal">uint32_t</span> addr = <span class="Constant">1</span><span class="Delimiter">;</span>
-<span id="L98" class="LineNr"> 98 </span>  <span class="Normal">char</span>* curr = <span class="Normal">const_cast</span>&lt;<span class="Normal">char</span>*&gt;<span class="Delimiter">(</span>&amp;text_bytes[<span class="Constant">0</span>]<span class="Delimiter">);</span>   <span class="Comment">// non-standard approach, but blessed by Herb Sutter (<a href="http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483)">http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483)</a></span>
+<span id="L95" class="LineNr"> 95 </span>  <span class="Normal">uint32_t</span> addr = <span class="Constant">1</span><span class="Delimiter">;</span>
+<span id="L96" class="LineNr"> 96 </span>  <span class="Comment">// we'll use C's 'strtol` to parse ASCII hex bytes</span>
+<span id="L97" class="LineNr"> 97 </span>  <span class="Comment">// strtol needs a char*, so we grab the buffer backing the string object</span>
+<span id="L98" class="LineNr"> 98 </span>  <span class="Normal">char</span>* curr = <span class="Normal">const_cast</span>&lt;<span class="Normal">char</span>*&gt;<span class="Delimiter">(</span>&amp;text_bytes[<span class="Constant">0</span>]<span class="Delimiter">);</span>   <span class="Comment">// non-portable, but blessed by Herb Sutter (<a href="http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483)">http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483)</a></span>
 <span id="L99" class="LineNr"> 99 </span>  <span class="Normal">char</span>* max = curr + strlen<span class="Delimiter">(</span>curr<span class="Delimiter">);</span>
 <span id="L100" class="LineNr">100 </span>  <span class="Normal">while</span> <span class="Delimiter">(</span>curr &lt; max<span class="Delimiter">)</span> <span class="Delimiter">{</span>
 <span id="L101" class="LineNr">101 </span>  <span class="Conceal">¦</span> <span class="Comment">// skip whitespace</span>
diff --git a/subx/010core.cc b/subx/010core.cc
index bb3919cf..d71df322 100644
--- a/subx/010core.cc
+++ b/subx/010core.cc
@@ -92,10 +92,10 @@ void run(const string& text_bytes) {
 }
 
 void load_program(const string& text_bytes) {
-  // now, to read the hex bytes in ASCII, we'll use C's strtol
-  // strtol needs a char*, so we grab the buffer backing the string object
   uint32_t addr = 1;
-  char* curr = const_cast<char*>(&text_bytes[0]);   // non-standard approach, but blessed by Herb Sutter (http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483)
+  // we'll use C's 'strtol` to parse ASCII hex bytes
+  // strtol needs a char*, so we grab the buffer backing the string object
+  char* curr = const_cast<char*>(&text_bytes[0]);   // non-portable, but blessed by Herb Sutter (http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483)
   char* max = curr + strlen(curr);
   while (curr < max) {
     // skip whitespace
/commit/082persist.cc?h=main&id=166e3c0d407a967d25d793b6a9db56ffd7a03727'>166e3c0d ^
0f3706a4 ^
78c50205 ^
0f3706a4 ^

78c50205 ^

0f3706a4 ^
fa94f4d9 ^





5c7ed3d6 ^
cfb142b9 ^
5c7ed3d6 ^


78c50205 ^
13ba3def ^



f3c75c73 ^
13ba3def ^
13ba3def ^

f3c75c73 ^


13ba3def ^






795f5244 ^
166e3c0d ^
13ba3def ^
166e3c0d ^
8d72e565 ^
e4630643 ^

78c50205 ^
166e3c0d ^

78c50205 ^
166e3c0d ^


9dcbec39 ^
166e3c0d ^

78c50205 ^
a0331a9b ^
166e3c0d ^





aa088845 ^
48e40252 ^
78c50205 ^
48e40252 ^

78c50205 ^

48e40252 ^
614ea44b ^
78c50205 ^
13ba3def ^

5aa38b52 ^
13ba3def ^
fc4a98dc ^

13ba3def ^
1b76245c ^
13ba3def ^

5aa38b52 ^





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117