[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 29 08:40:26 PDT 2018


leonardchan added inline comments.


================
Comment at: lib/Sema/SemaType.cpp:1430
     } else {
-      switch (DS.getTypeSpecWidth()) {
-        case DeclSpec::TSW_short:
-          Result = Context.UnsignedShortAccumTy;
-          break;
-        case DeclSpec::TSW_unspecified:
-          Result = Context.UnsignedAccumTy;
-          break;
-        case DeclSpec::TSW_long:
-          Result = Context.UnsignedLongAccumTy;
-          break;
-        case DeclSpec::TSW_longlong:
-          // TODO: Replace with diag
-          llvm_unreachable("Unable to specify long long as _Accum width");
-          break;
+      if (DS.getTypeSpecSign() != DeclSpec::TSS_unsigned) {
+        switch (DS.getTypeSpecWidth()) {
----------------
ebevhan wrote:
> You should probably use the 'getCorrespondingSaturatingType' function instead of disambiguating the whole thing here again.
Also used getCorrespondingSignedType() for the signage


Repository:
  rC Clang

https://reviews.llvm.org/D46911





More information about the cfe-commits mailing list