GCC Wikia
Advertisement

このページを編集する際は,編集に関する方針に従ってください.[]

概要[]

  • gcc-4.1.0/gcc/fold-const.cにて定義
  • ダブルワード同士の加算
    • v = 1 + 2
  • 返り値はオーバーフローしたかどうか

引数[]

実装[]

284 /* Add two doubleword integers with doubleword result.
285    Each argument is given as two `HOST_WIDE_INT' pieces.
286    One argument is L1 and H1; the other, L2 and H2.
287    The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV.  */
288 
289 int
290 add_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
291             unsigned HOST_WIDE_INT l2, HOST_WIDE_INT h2,
292             unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv)
293 {
294   unsigned HOST_WIDE_INT l;
295   HOST_WIDE_INT h;
296 
297   l = l1 + l2;

  • 桁上がりを考慮

298   h = h1 + h2 + (l < l1);
299 
300   *lv = l;
301   *hv = h;
302   return OVERFLOW_SUM_SIGN (h1, h2, h);
303 }

Advertisement