Deleted Added
sdiff udiff text old ( 121642 ) new ( 160157 )
full compact
1/*
2Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
3Permission is hereby granted, free of charge, to any person
4obtaining a copy of this software and associated documentation
5files (the "Software"), to deal in the Software without
6restriction, including without limitation the rights to use,
7copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the
9Software is furnished to do so, subject to the following
10conditions:

--- 30 unchanged lines hidden (view full) ---

41 bstream->bufp = (unsigned char *) &bstream->buf;
42 bstream->nbuf = 0;
43 bstream->copyin = env->copyin;
44 bstream->cb_token = env->cb_token;
45 bstream->request = request;
46 }
47 else {
48 bstream->source = 0;
49 bstream->bufp = (unsigned char *) (intptr_t) source;
50 bstream->nbuf = len;
51 bstream->copyin = 0;
52 bstream->cb_token = 0;
53 bstream->request = 0;
54 }
55 bstream->ntotal = len;
56 bstream->peekc = -1;
57}
58
59
60/* uwx_get_byte: read the next byte from the byte stream */
61
62int uwx_get_byte(struct uwx_bstream *bstream)
63{
64 int len;
65 int n;
66 int b;
67 uint32_t *wp;
68 uint64_t *dp;
69
70 if (bstream->peekc >= 0) {
71 b = bstream->peekc;
72 bstream->peekc = -1;
73 return b;
74 }
75 if (bstream->ntotal <= 0)
76 return -1;

--- 49 unchanged lines hidden (view full) ---

126 val |= (uint64_t)(b & 0x7f) << 63;
127 }
128 if (b & 0x80)
129 return -1;
130 *valp = val;
131 return 0;
132}
133
134int uwx_get_uleb128_alt(struct uwx_bstream *bstream, uint64_t *valp)
135{
136 uint64_t val;
137 int b;
138
139 b = uwx_get_byte(bstream);
140 val = b & 0x7f;
141 if (b & 0x80) {

--- 32 unchanged lines hidden (view full) ---

174 }
175 }
176 }
177 }
178 }
179 *valp = val;
180 return 0;
181}