Browse Source

* a homogeneous float aggregate can maximally contain 4 elements
(mantis #27665)

git-svn-id: trunk@30229 -

Jonas Maebe 10 years ago
parent
commit
8334597476
3 changed files with 29 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/aarch64/cpupara.pas
  3. 27 0
      tests/webtbs/tw27665.pp

+ 1 - 0
.gitattributes

@@ -14334,6 +14334,7 @@ tests/webtbs/tw2758.pp svneol=native#text/plain
 tests/webtbs/tw2763.pp svneol=native#text/plain
 tests/webtbs/tw27634.pp svneol=native#text/plain
 tests/webtbs/tw2765.pp svneol=native#text/plain
+tests/webtbs/tw27665.pp svneol=native#text/plain
 tests/webtbs/tw2767.pp svneol=native#text/plain
 tests/webtbs/tw2771.pp svneol=native#text/plain
 tests/webtbs/tw2772.pp svneol=native#text/plain

+ 1 - 0
compiler/aarch64/cpupara.pas

@@ -164,6 +164,7 @@ unit cpupara;
         result:=
           result and
           (elecount>0) and
+          (elecount<=4) and
           (p.size=basedef.size*elecount)
       end;
 

+ 27 - 0
tests/webtbs/tw27665.pp

@@ -0,0 +1,27 @@
+{$mode objfpc}
+
+      function UTF8CodePointLength(firstbyte: byte): SizeInt;
+      var
+        firstzerobit: SizeInt;
+      begin
+        result:=1;
+        { bsr searches for the leftmost 1 bit. We are interested in the
+          leftmost 0 bit, so first invert the value
+        }
+        firstzerobit:=BsrByte(not(firstbyte));
+        { if there is no zero bit or the first zero bit is the rightmost bit
+          (bit 0), this is an invalid UTF-8 byte ($ff cannot appear in an
+          UTF-8-encoded string, and in the worst case bit 1 has to be zero)
+        }
+        if (firstzerobit=0) or (firstzerobit=255)  then
+          exit;
+        { the number of bytes belonging to this code point is
+          7-(pos first 0-bit).
+        }
+        result:=7-firstzerobit;
+      end;
+
+
+begin
+  writeln(UTF8CodePointLength(ord(' ')));
+end.