Explorar o código

* is_signed() only returns true for orddef's whose low value is < 0
(and not for all s8bit..s64bit types, since subrange types may
be marked like that but not have a lower bound < 0).

This is needed for bitpacking negative values, because e.g.
both 0..7 and -3..3 can be stored in 3 bits, but 0..7 must be
zero-extended when extracted (so must be unsigned) and -3..3 must
be sign-extended when extracted (so must be considered signed)

git-svn-id: trunk@6682 -

Jonas Maebe %!s(int64=18) %!d(string=hai) anos
pai
achega
7925bed48d
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      compiler/defutil.pas

+ 1 - 1
compiler/defutil.pas

@@ -437,7 +437,7 @@ implementation
       begin
          case def.typ of
            orddef :
-             result:=(torddef(def).ordtype in [s8bit,s16bit,s32bit,s64bit,scurrency]);
+             result:=torddef(def).low < 0;
            enumdef :
              result:=tenumdef(def).min < 0;
            arraydef :