aefa1d4de1145997a10a553ebc09ed1f22e72ff1
[deliverable/binutils-gdb.git] / gdb / valarith.c
1 /* Perform arithmetic and other operations on values, for GDB.
2 Copyright 1986, 1989, 1991 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 #include <stdio.h>
21
22 #include "defs.h"
23 #include "value.h"
24 #include "symtab.h"
25 #include "expression.h"
26 #include "target.h"
27 #include <string.h>
28
29 static value
30 value_subscripted_rvalue PARAMS ((value, value));
31
32 \f
33 value
34 value_add (arg1, arg2)
35 value arg1, arg2;
36 {
37 register value valint, valptr;
38 register int len;
39
40 COERCE_ARRAY (arg1);
41 COERCE_ARRAY (arg2);
42
43 if ((TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR
44 || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_PTR)
45 &&
46 (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_INT
47 || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_INT))
48 /* Exactly one argument is a pointer, and one is an integer. */
49 {
50 if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR)
51 {
52 valptr = arg1;
53 valint = arg2;
54 }
55 else
56 {
57 valptr = arg2;
58 valint = arg1;
59 }
60 len = TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (valptr)));
61 if (len == 0) len = 1; /* For (void *) */
62 return value_from_longest (VALUE_TYPE (valptr),
63 value_as_long (valptr)
64 + (len * value_as_long (valint)));
65 }
66
67 return value_binop (arg1, arg2, BINOP_ADD);
68 }
69
70 value
71 value_sub (arg1, arg2)
72 value arg1, arg2;
73 {
74
75 COERCE_ARRAY (arg1);
76 COERCE_ARRAY (arg2);
77
78 if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR)
79 {
80 if (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_INT)
81 {
82 /* pointer - integer. */
83 return value_from_longest
84 (VALUE_TYPE (arg1),
85 value_as_long (arg1)
86 - (TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)))
87 * value_as_long (arg2)));
88 }
89 else if (VALUE_TYPE (arg1) == VALUE_TYPE (arg2))
90 {
91 /* pointer to <type x> - pointer to <type x>. */
92 return value_from_longest
93 (builtin_type_long, /* FIXME -- should be ptrdiff_t */
94 (value_as_long (arg1) - value_as_long (arg2))
95 / TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))));
96 }
97 else
98 {
99 error ("\
100 First argument of `-' is a pointer and second argument is neither\n\
101 an integer nor a pointer of the same type.");
102 }
103 }
104
105 return value_binop (arg1, arg2, BINOP_SUB);
106 }
107
108 /* Return the value of ARRAY[IDX]. */
109
110 value
111 value_subscript (array, idx)
112 value array, idx;
113 {
114 if (TYPE_CODE (VALUE_TYPE (array)) == TYPE_CODE_ARRAY
115 && VALUE_LVAL (array) != lval_memory)
116 return value_subscripted_rvalue (array, idx);
117 else
118 return value_ind (value_add (array, idx));
119 }
120
121 /* Return the value of EXPR[IDX], expr an aggregate rvalue
122 (eg, a vector register). This routine used to promote floats
123 to doubles, but no longer does. */
124
125 static value
126 value_subscripted_rvalue (array, idx)
127 value array, idx;
128 {
129 struct type *elt_type = TYPE_TARGET_TYPE (VALUE_TYPE (array));
130 int elt_size = TYPE_LENGTH (elt_type);
131 int elt_offs = elt_size * longest_to_int (value_as_long (idx));
132 value v;
133
134 if (elt_offs >= TYPE_LENGTH (VALUE_TYPE (array)))
135 error ("no such vector element");
136
137 v = allocate_value (elt_type);
138 bcopy (VALUE_CONTENTS (array) + elt_offs, VALUE_CONTENTS (v), elt_size);
139
140 if (VALUE_LVAL (array) == lval_internalvar)
141 VALUE_LVAL (v) = lval_internalvar_component;
142 else
143 VALUE_LVAL (v) = not_lval;
144 VALUE_ADDRESS (v) = VALUE_ADDRESS (array);
145 VALUE_OFFSET (v) = VALUE_OFFSET (array) + elt_offs;
146 VALUE_BITSIZE (v) = elt_size * 8;
147 return v;
148 }
149 \f
150 /* Check to see if either argument is a structure. This is called so
151 we know whether to go ahead with the normal binop or look for a
152 user defined function instead.
153
154 For now, we do not overload the `=' operator. */
155
156 int
157 binop_user_defined_p (op, arg1, arg2)
158 enum exp_opcode op;
159 value arg1, arg2;
160 {
161 if (op == BINOP_ASSIGN)
162 return 0;
163 return (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT
164 || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_STRUCT
165 || (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
166 && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_STRUCT)
167 || (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_REF
168 && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) == TYPE_CODE_STRUCT));
169 }
170
171 /* Check to see if argument is a structure. This is called so
172 we know whether to go ahead with the normal unop or look for a
173 user defined function instead.
174
175 For now, we do not overload the `&' operator. */
176
177 int unop_user_defined_p (op, arg1)
178 enum exp_opcode op;
179 value arg1;
180 {
181 if (op == UNOP_ADDR)
182 return 0;
183 return (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT
184 || (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
185 && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_STRUCT));
186 }
187
188 /* We know either arg1 or arg2 is a structure, so try to find the right
189 user defined function. Create an argument vector that calls
190 arg1.operator @ (arg1,arg2) and return that value (where '@' is any
191 binary operator which is legal for GNU C++).
192
193 OP is the operatore, and if it is BINOP_ASSIGN_MODIFY, then OTHEROP
194 is the opcode saying how to modify it. Otherwise, OTHEROP is
195 unused. */
196
197 value
198 value_x_binop (arg1, arg2, op, otherop)
199 value arg1, arg2;
200 enum exp_opcode op, otherop;
201 {
202 value * argvec;
203 char *ptr;
204 char tstr[13];
205 int static_memfuncp;
206
207 COERCE_REF (arg1);
208 COERCE_REF (arg2);
209 COERCE_ENUM (arg1);
210 COERCE_ENUM (arg2);
211
212 /* now we know that what we have to do is construct our
213 arg vector and find the right function to call it with. */
214
215 if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_STRUCT)
216 error ("Can't do that binary op on that type"); /* FIXME be explicit */
217
218 argvec = (value *) alloca (sizeof (value) * 4);
219 argvec[1] = value_addr (arg1);
220 argvec[2] = arg2;
221 argvec[3] = 0;
222
223 /* make the right function name up */
224 strcpy(tstr, "operator__");
225 ptr = tstr+8;
226 switch (op)
227 {
228 case BINOP_ADD: strcpy(ptr,"+"); break;
229 case BINOP_SUB: strcpy(ptr,"-"); break;
230 case BINOP_MUL: strcpy(ptr,"*"); break;
231 case BINOP_DIV: strcpy(ptr,"/"); break;
232 case BINOP_REM: strcpy(ptr,"%"); break;
233 case BINOP_LSH: strcpy(ptr,"<<"); break;
234 case BINOP_RSH: strcpy(ptr,">>"); break;
235 case BINOP_LOGAND: strcpy(ptr,"&"); break;
236 case BINOP_LOGIOR: strcpy(ptr,"|"); break;
237 case BINOP_LOGXOR: strcpy(ptr,"^"); break;
238 case BINOP_AND: strcpy(ptr,"&&"); break;
239 case BINOP_OR: strcpy(ptr,"||"); break;
240 case BINOP_MIN: strcpy(ptr,"<?"); break;
241 case BINOP_MAX: strcpy(ptr,">?"); break;
242 case BINOP_ASSIGN: strcpy(ptr,"="); break;
243 case BINOP_ASSIGN_MODIFY:
244 switch (otherop)
245 {
246 case BINOP_ADD: strcpy(ptr,"+="); break;
247 case BINOP_SUB: strcpy(ptr,"-="); break;
248 case BINOP_MUL: strcpy(ptr,"*="); break;
249 case BINOP_DIV: strcpy(ptr,"/="); break;
250 case BINOP_REM: strcpy(ptr,"%="); break;
251 case BINOP_LOGAND: strcpy(ptr,"&="); break;
252 case BINOP_LOGIOR: strcpy(ptr,"|="); break;
253 case BINOP_LOGXOR: strcpy(ptr,"^="); break;
254 default:
255 error ("Invalid binary operation specified.");
256 }
257 break;
258 case BINOP_SUBSCRIPT: strcpy(ptr,"[]"); break;
259 case BINOP_EQUAL: strcpy(ptr,"=="); break;
260 case BINOP_NOTEQUAL: strcpy(ptr,"!="); break;
261 case BINOP_LESS: strcpy(ptr,"<"); break;
262 case BINOP_GTR: strcpy(ptr,">"); break;
263 case BINOP_GEQ: strcpy(ptr,">="); break;
264 case BINOP_LEQ: strcpy(ptr,"<="); break;
265 default:
266 error ("Invalid binary operation specified.");
267 }
268 argvec[0] = value_struct_elt (&arg1, argvec+1, tstr, &static_memfuncp, "structure");
269 if (argvec[0])
270 {
271 if (static_memfuncp)
272 {
273 argvec[1] = argvec[0];
274 argvec++;
275 }
276 return target_call_function (argvec[0], 2 - static_memfuncp, argvec + 1);
277 }
278 error ("member function %s not found", tstr);
279 #ifdef lint
280 return target_call_function (argvec[0], 2 - static_memfuncp, argvec + 1);
281 #endif
282 }
283
284 /* We know that arg1 is a structure, so try to find a unary user
285 defined operator that matches the operator in question.
286 Create an argument vector that calls arg1.operator @ (arg1)
287 and return that value (where '@' is (almost) any unary operator which
288 is legal for GNU C++). */
289
290 value
291 value_x_unop (arg1, op)
292 value arg1;
293 enum exp_opcode op;
294 {
295 value * argvec;
296 char *ptr;
297 char tstr[13];
298 int static_memfuncp;
299
300 COERCE_ENUM (arg1);
301
302 /* now we know that what we have to do is construct our
303 arg vector and find the right function to call it with. */
304
305 if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_STRUCT)
306 error ("Can't do that unary op on that type"); /* FIXME be explicit */
307
308 argvec = (value *) alloca (sizeof (value) * 3);
309 argvec[1] = value_addr (arg1);
310 argvec[2] = 0;
311
312 /* make the right function name up */
313 strcpy(tstr,"operator__");
314 ptr = tstr+8;
315 switch (op)
316 {
317 case UNOP_PREINCREMENT: strcpy(ptr,"++"); break;
318 case UNOP_PREDECREMENT: strcpy(ptr,"++"); break;
319 case UNOP_POSTINCREMENT: strcpy(ptr,"++"); break;
320 case UNOP_POSTDECREMENT: strcpy(ptr,"++"); break;
321 case UNOP_ZEROP: strcpy(ptr,"!"); break;
322 case UNOP_LOGNOT: strcpy(ptr,"~"); break;
323 case UNOP_NEG: strcpy(ptr,"-"); break;
324 default:
325 error ("Invalid binary operation specified.");
326 }
327 argvec[0] = value_struct_elt (&arg1, argvec+1, tstr, &static_memfuncp, "structure");
328 if (argvec[0])
329 {
330 if (static_memfuncp)
331 {
332 argvec[1] = argvec[0];
333 argvec++;
334 }
335 return target_call_function (argvec[0], 1 - static_memfuncp, argvec + 1);
336 }
337 error ("member function %s not found", tstr);
338 return 0; /* For lint -- never reached */
339 }
340 \f
341 /* Perform a binary operation on two integers or two floats.
342 Does not support addition and subtraction on pointers;
343 use value_add or value_sub if you want to handle those possibilities. */
344
345 value
346 value_binop (arg1, arg2, op)
347 value arg1, arg2;
348 enum exp_opcode op;
349 {
350 register value val;
351
352 COERCE_ENUM (arg1);
353 COERCE_ENUM (arg2);
354
355 if ((TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_FLT
356 &&
357 TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_INT)
358 ||
359 (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_FLT
360 &&
361 TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT))
362 error ("Argument to arithmetic operation not a number.");
363
364 if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_FLT
365 ||
366 TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_FLT)
367 {
368 double v1, v2, v;
369 v1 = value_as_double (arg1);
370 v2 = value_as_double (arg2);
371 switch (op)
372 {
373 case BINOP_ADD:
374 v = v1 + v2;
375 break;
376
377 case BINOP_SUB:
378 v = v1 - v2;
379 break;
380
381 case BINOP_MUL:
382 v = v1 * v2;
383 break;
384
385 case BINOP_DIV:
386 v = v1 / v2;
387 break;
388
389 default:
390 error ("Integer-only operation on floating point number.");
391 }
392
393 val = allocate_value (builtin_type_double);
394 SWAP_TARGET_AND_HOST (&v, sizeof (v));
395 *(double *) VALUE_CONTENTS_RAW (val) = v;
396 }
397 else
398 /* Integral operations here. */
399 {
400 /* Should we promote to unsigned longest? */
401 if ((TYPE_UNSIGNED (VALUE_TYPE (arg1))
402 || TYPE_UNSIGNED (VALUE_TYPE (arg2)))
403 && (TYPE_LENGTH (VALUE_TYPE (arg1)) >= sizeof (unsigned LONGEST)
404 || TYPE_LENGTH (VALUE_TYPE (arg1)) >= sizeof (unsigned LONGEST)))
405 {
406 unsigned LONGEST v1, v2, v;
407 v1 = (unsigned LONGEST) value_as_long (arg1);
408 v2 = (unsigned LONGEST) value_as_long (arg2);
409
410 switch (op)
411 {
412 case BINOP_ADD:
413 v = v1 + v2;
414 break;
415
416 case BINOP_SUB:
417 v = v1 - v2;
418 break;
419
420 case BINOP_MUL:
421 v = v1 * v2;
422 break;
423
424 case BINOP_DIV:
425 v = v1 / v2;
426 break;
427
428 case BINOP_REM:
429 v = v1 % v2;
430 break;
431
432 case BINOP_LSH:
433 v = v1 << v2;
434 break;
435
436 case BINOP_RSH:
437 v = v1 >> v2;
438 break;
439
440 case BINOP_LOGAND:
441 v = v1 & v2;
442 break;
443
444 case BINOP_LOGIOR:
445 v = v1 | v2;
446 break;
447
448 case BINOP_LOGXOR:
449 v = v1 ^ v2;
450 break;
451
452 case BINOP_AND:
453 v = v1 && v2;
454 break;
455
456 case BINOP_OR:
457 v = v1 || v2;
458 break;
459
460 case BINOP_MIN:
461 v = v1 < v2 ? v1 : v2;
462 break;
463
464 case BINOP_MAX:
465 v = v1 > v2 ? v1 : v2;
466 break;
467
468 default:
469 error ("Invalid binary operation on numbers.");
470 }
471
472 val = allocate_value (BUILTIN_TYPE_UNSIGNED_LONGEST);
473 SWAP_TARGET_AND_HOST (&v, sizeof (v));
474 *(unsigned LONGEST *) VALUE_CONTENTS_RAW (val) = v;
475 }
476 else
477 {
478 LONGEST v1, v2, v;
479 v1 = value_as_long (arg1);
480 v2 = value_as_long (arg2);
481
482 switch (op)
483 {
484 case BINOP_ADD:
485 v = v1 + v2;
486 break;
487
488 case BINOP_SUB:
489 v = v1 - v2;
490 break;
491
492 case BINOP_MUL:
493 v = v1 * v2;
494 break;
495
496 case BINOP_DIV:
497 v = v1 / v2;
498 break;
499
500 case BINOP_REM:
501 v = v1 % v2;
502 break;
503
504 case BINOP_LSH:
505 v = v1 << v2;
506 break;
507
508 case BINOP_RSH:
509 v = v1 >> v2;
510 break;
511
512 case BINOP_LOGAND:
513 v = v1 & v2;
514 break;
515
516 case BINOP_LOGIOR:
517 v = v1 | v2;
518 break;
519
520 case BINOP_LOGXOR:
521 v = v1 ^ v2;
522 break;
523
524 case BINOP_AND:
525 v = v1 && v2;
526 break;
527
528 case BINOP_OR:
529 v = v1 || v2;
530 break;
531
532 case BINOP_MIN:
533 v = v1 < v2 ? v1 : v2;
534 break;
535
536 case BINOP_MAX:
537 v = v1 > v2 ? v1 : v2;
538 break;
539
540 default:
541 error ("Invalid binary operation on numbers.");
542 }
543
544 val = allocate_value (BUILTIN_TYPE_LONGEST);
545 SWAP_TARGET_AND_HOST (&v, sizeof (v));
546 *(LONGEST *) VALUE_CONTENTS_RAW (val) = v;
547 }
548 }
549
550 return val;
551 }
552 \f
553 /* Simulate the C operator ! -- return 1 if ARG1 contains zeros. */
554
555 int
556 value_zerop (arg1)
557 value arg1;
558 {
559 register int len;
560 register char *p;
561
562 COERCE_ARRAY (arg1);
563
564 len = TYPE_LENGTH (VALUE_TYPE (arg1));
565 p = VALUE_CONTENTS (arg1);
566
567 while (--len >= 0)
568 {
569 if (*p++)
570 break;
571 }
572
573 return len < 0;
574 }
575
576 /* Simulate the C operator == by returning a 1
577 iff ARG1 and ARG2 have equal contents. */
578
579 int
580 value_equal (arg1, arg2)
581 register value arg1, arg2;
582
583 {
584 register int len;
585 register char *p1, *p2;
586 enum type_code code1;
587 enum type_code code2;
588
589 COERCE_ARRAY (arg1);
590 COERCE_ARRAY (arg2);
591
592 code1 = TYPE_CODE (VALUE_TYPE (arg1));
593 code2 = TYPE_CODE (VALUE_TYPE (arg2));
594
595 if (code1 == TYPE_CODE_INT && code2 == TYPE_CODE_INT)
596 return value_as_long (arg1) == value_as_long (arg2);
597 else if ((code1 == TYPE_CODE_FLT || code1 == TYPE_CODE_INT)
598 && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT))
599 return value_as_double (arg1) == value_as_double (arg2);
600
601 /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
602 is bigger. */
603 else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_INT)
604 return value_as_pointer (arg1) == (CORE_ADDR) value_as_long (arg2);
605 else if (code2 == TYPE_CODE_PTR && code1 == TYPE_CODE_INT)
606 return (CORE_ADDR) value_as_long (arg1) == value_as_pointer (arg2);
607
608 else if (code1 == code2
609 && ((len = TYPE_LENGTH (VALUE_TYPE (arg1)))
610 == TYPE_LENGTH (VALUE_TYPE (arg2))))
611 {
612 p1 = VALUE_CONTENTS (arg1);
613 p2 = VALUE_CONTENTS (arg2);
614 while (--len >= 0)
615 {
616 if (*p1++ != *p2++)
617 break;
618 }
619 return len < 0;
620 }
621 else
622 {
623 error ("Invalid type combination in equality test.");
624 return 0; /* For lint -- never reached */
625 }
626 }
627
628 /* Simulate the C operator < by returning 1
629 iff ARG1's contents are less than ARG2's. */
630
631 int
632 value_less (arg1, arg2)
633 register value arg1, arg2;
634 {
635 register enum type_code code1;
636 register enum type_code code2;
637
638 COERCE_ARRAY (arg1);
639 COERCE_ARRAY (arg2);
640
641 code1 = TYPE_CODE (VALUE_TYPE (arg1));
642 code2 = TYPE_CODE (VALUE_TYPE (arg2));
643
644 if (code1 == TYPE_CODE_INT && code2 == TYPE_CODE_INT)
645 {
646 if (TYPE_UNSIGNED (VALUE_TYPE (arg1))
647 || TYPE_UNSIGNED (VALUE_TYPE (arg2)))
648 return ((unsigned LONGEST) value_as_long (arg1)
649 < (unsigned LONGEST) value_as_long (arg2));
650 else
651 return value_as_long (arg1) < value_as_long (arg2);
652 }
653 else if ((code1 == TYPE_CODE_FLT || code1 == TYPE_CODE_INT)
654 && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT))
655 return value_as_double (arg1) < value_as_double (arg2);
656 else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
657 return value_as_pointer (arg1) < value_as_pointer (arg2);
658
659 /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
660 is bigger. */
661 else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_INT)
662 return value_as_pointer (arg1) < (CORE_ADDR) value_as_long (arg2);
663 else if (code2 == TYPE_CODE_PTR && code1 == TYPE_CODE_INT)
664 return (CORE_ADDR) value_as_long (arg1) < value_as_pointer (arg2);
665
666 else
667 {
668 error ("Invalid type combination in ordering comparison.");
669 return 0;
670 }
671 }
672 \f
673 /* The unary operators - and ~. Both free the argument ARG1. */
674
675 value
676 value_neg (arg1)
677 register value arg1;
678 {
679 register struct type *type;
680
681 COERCE_ENUM (arg1);
682
683 type = VALUE_TYPE (arg1);
684
685 if (TYPE_CODE (type) == TYPE_CODE_FLT)
686 return value_from_double (type, - value_as_double (arg1));
687 else if (TYPE_CODE (type) == TYPE_CODE_INT)
688 return value_from_longest (type, - value_as_long (arg1));
689 else {
690 error ("Argument to negate operation not a number.");
691 return 0; /* For lint -- never reached */
692 }
693 }
694
695 value
696 value_lognot (arg1)
697 register value arg1;
698 {
699 COERCE_ENUM (arg1);
700
701 if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_INT)
702 error ("Argument to complement operation not an integer.");
703
704 return value_from_longest (VALUE_TYPE (arg1), ~ value_as_long (arg1));
705 }
706 \f
This page took 0.075187 seconds and 4 git commands to generate.