Lines Matching refs:result

156     mpd_t *result;
160 result = mpd_alloc(1, sizeof *result);
161 if (result == NULL) {
165 result->data = mpd_alloc(nwords, sizeof *result->data);
166 if (result->data == NULL) {
167 mpd_free(result);
171 result->flags = 0;
172 result->exp = 0;
173 result->digits = 0;
174 result->len = 0;
175 result->alloc = nwords;
177 return result;
193 mpd_t *result;
195 result = mpd_qnew();
196 if (result == NULL) {
199 return result;
203 * Input: 'result' is a static mpd_t with a static coefficient.
204 * Assumption: 'nwords' >= result->alloc.
207 * existing data. If successful, the value of 'result' is unchanged.
208 * Otherwise, set 'result' to NaN and update 'status' with MPD_Malloc_error.
211 mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t nwords, uint32_t *status)
213 mpd_uint_t *p = result->data;
215 assert(nwords >= result->alloc);
217 result->data = mpd_alloc(nwords, sizeof *result->data);
218 if (result->data == NULL) {
219 result->data = p;
220 mpd_set_qnan(result);
221 mpd_set_positive(result);
222 result->exp = result->digits = result->len = 0;
227 memcpy(result->data, p, result->alloc * (sizeof *result->data));
228 result->alloc = nwords;
229 mpd_set_dynamic_data(result);
234 * Input: 'result' is a static mpd_t with a static coefficient.
237 * malloc fails, set 'result' to NaN and update 'status' with MPD_Malloc_error.
240 mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t nwords, uint32_t *status)
242 mpd_uint_t *p = result->data;
244 result->data = mpd_calloc(nwords, sizeof *result->data);
245 if (result->data == NULL) {
246 result->data = p;
247 mpd_set_qnan(result);
248 mpd_set_positive(result);
249 result->exp = result->digits = result->len = 0;
254 result->alloc = nwords;
255 mpd_set_dynamic_data(result);
261 * Input: 'result' is a static or a dynamic mpd_t with a dynamic coefficient.
263 * Case nwords > result->alloc:
265 * 'result' has a larger coefficient but the same value. Return 1.
267 * Set 'result' to NaN, update status with MPD_Malloc_error and return 0.
268 * Case nwords < result->alloc:
270 * 'result' has a smaller coefficient. result->len is undefined. Return 1.
272 * 'result' is unchanged. Reuse the now oversized coefficient. Return 1.
275 mpd_realloc_dyn(mpd_t *result, mpd_ssize_t nwords, uint32_t *status)
279 result->data = mpd_realloc(result->data, nwords, sizeof *result->data, &err);
281 result->alloc = nwords;
283 else if (nwords > result->alloc) {
284 mpd_set_qnan(result);
285 mpd_set_positive(result);
286 result->exp = result->digits = result->len = 0;
295 * Input: 'result' is a static mpd_t with a static coefficient.
296 * Assumption: 'nwords' >= result->alloc.
301 * On failure the value of 'result' is unchanged.
304 mpd_switch_to_dyn_cxx(mpd_t *result, mpd_ssize_t nwords)
306 assert(nwords >= result->alloc);
308 mpd_uint_t *data = mpd_alloc(nwords, sizeof *result->data);
313 memcpy(data, result->data, result->alloc * (sizeof *result->data));
314 result->data = data;
315 result->alloc = nwords;
316 mpd_set_dynamic_data(result);
321 * Input: 'result' is a static or a dynamic mpd_t with a dynamic coefficient.
323 * Case nwords > result->alloc:
325 * 'result' has a larger coefficient but the same value. Return 1.
327 * 'result' has a the same coefficient. Return 0.
328 * Case nwords < result->alloc:
330 * 'result' has a smaller coefficient. result->len is undefined. Return 1.
332 * 'result' is unchanged. Reuse the now oversized coefficient. Return 1.
335 mpd_realloc_dyn_cxx(mpd_t *result, mpd_ssize_t nwords)
339 mpd_uint_t *p = mpd_realloc(result->data, nwords, sizeof *result->data, &err);
341 result->data = p;
342 result->alloc = nwords;
344 else if (nwords > result->alloc) {