Commit Graph

255 Commits

Author SHA1 Message Date
Rika Ichinose
0d3d4918b3 Don’t allow generic fpc_pchar_length to arbitrarily over-read. 2023-11-01 20:04:40 +00:00
Rika Ichinose
8d1d763a1a Don’t use local shortstring in generic fpc_pchar_to_shortstr, move directly to the destination. 2023-11-01 20:04:40 +00:00
Michael VAN CANNEYT
d2d3fe6bc3 * Char -> AnsiChar 2023-07-14 17:26:10 +02:00
Rika Ichinose
f0811e448d Improve generic CompareWord. 2023-02-25 22:52:38 +00:00
Rika Ichinose
ee5b9e53a9 Improve generic CompareDWord. 2023-02-19 18:07:46 +00:00
Jonas Maebe
ffa14ee448 Utf8CodePointLen: remove pointer arithmetic to fix JVM compatibility 2023-02-05 10:58:59 +01:00
Rika Ichinose
b38d13577f Make Utf8CodepointLen adhere to the Unicode standard somewhat more and know all of the Unicode 15.0 combining characters. 2023-01-30 13:51:31 +00:00
florian
218da184e6 * patch by Rika: Improve generic CompareByte, resolves #40120 2023-01-19 22:44:25 +01:00
Rika Ichinose
30e3d93d57 Make generic Index* faster and denser. 2023-01-09 21:26:00 +00:00
florian
c1ec558d0a * first (modified, added a comment) patch by Rika to improve generic Index*, part of #39996 2022-11-17 23:11:23 +01:00
ccrause
031c16dd3c Fix potential overflow when incrementing 8 bit high value of res. 2022-11-05 11:19:58 +02:00
ccrause
991460c4ee Rewrite fpc_shortstr_concat_multi for AVR to not use a temporary shortstring to reduce RAM usage. 2022-10-19 20:18:56 +00:00
Jonas Maebe
0758aa1143 FPU exception mask: generlised system unit interface 2022-10-17 19:43:01 +00:00
florian
799c22d553 Revert " * patch by Rika: SwapEndian([u]int16) has unnecessary “and $FFFF”, resolves #39814"
This reverts commit f92102a5f2.

The and $ffff is needed to avoid range check warnings when the function is inlined with a constant parameter
2022-07-15 18:56:11 +02:00
florian
f92102a5f2 * patch by Rika: SwapEndian([u]int16) has unnecessary “and $FFFF”, resolves #39814 2022-06-27 22:45:01 +02:00
florian
781b2d0a80 * patch by Rika: second part of #39496, resolves #30496
+ extended test
2021-12-25 20:01:32 +01:00
Károly Balogh
45b5e9215c rtl: remove defines for v2.x compiler from the common part of the RTL. It's no longer suppported to build with that
git-svn-id: trunk@49036 -
2021-03-23 09:32:49 +00:00
florian
3072df59ff * overflow checked mul helpers do not need to check all bits either
git-svn-id: trunk@48999 -
2021-03-17 21:30:41 +00:00
svenbarth
0c316deab5 * readd SmallInt typecasts to SmallInt overload of SwapEndian
git-svn-id: trunk@46898 -
2020-09-19 17:42:04 +00:00
svenbarth
9d86fed95b * avoid range check error when using SwapEndian with 16-bit constants
+ added test

git-svn-id: trunk@46897 -
2020-09-19 17:04:17 +00:00
yury
ec10ee8218 * Improved generic implementations of fpc_mul_dword, fpc_mul_word, fpc_mul_byte to use less iterations and registers.
git-svn-id: trunk@46269 -
2020-08-05 17:58:46 +00:00
florian
828e961f3d * remove unused constants
git-svn-id: trunk@43351 -
2019-11-01 18:39:17 +00:00
Jeppe Johansen
1b698d319f - Fix bug in software overflow checking for longint's.
- AVR: Fix overflow checking for HW multiplications

git-svn-id: trunk@42531 -
2019-07-30 13:42:26 +00:00
Jeppe Johansen
67bf76c50e - Fix overflow checking in software multiplication routines. Overflow checking should also be enabled for the unsigned multiplications.
- Call FPC_Overflow instead of multiple calls to save on size.

git-svn-id: trunk@42491 -
2019-07-25 12:49:55 +00:00
florian
90557f2e62 * properly calcualte aligncount as proposed by Jeppe, should resolve #33323
git-svn-id: trunk@40449 -
2018-12-02 14:49:24 +00:00
yury
a19528efa1 * Fixed warnings.
git-svn-id: trunk@40188 -
2018-11-02 19:22:46 +00:00
florian
33463c8698 * moved align helper so it actually gets inlined
git-svn-id: trunk@40011 -
2018-10-21 20:50:21 +00:00
florian
7817102727 * patch by Christo Crause to implement 8 bit multiplications for "mul-less" avr types, resolves issue #31925
git-svn-id: trunk@37380 -
2017-10-01 20:34:44 +00:00
florian
16c9a2260d * check alignment properly in CompareDWord for 64 bit targets
git-svn-id: trunk@36656 -
2017-07-06 18:02:22 +00:00
nickysn
34113b930b * removed the checkoverflow: boolean parameter of the software mul helpers;
replaced it with a separate "_checkoverflow" version of each helper

git-svn-id: trunk@36344 -
2017-05-26 15:34:26 +00:00
nickysn
ba665e103c + added sqr(shortint) and sqr(smallint) for CPUs with 8/16-bit alu
git-svn-id: trunk@36342 -
2017-05-26 13:16:36 +00:00
nickysn
78a7445751 + added Odd(byte) and Odd(shortint) for cpus with 8-bit alu and Odd(word)/
Odd(smallint) for cpus with 8 or 16-bit alu

git-svn-id: trunk@36328 -
2017-05-25 14:42:56 +00:00
nickysn
fa645dcaf7 + added abs(smallint) and abs(shortint) for cpus with 8-bit or 16-bit alu
git-svn-id: trunk@36327 -
2017-05-25 14:14:18 +00:00
Károly Balogh
346f040a54 also try to inline 32bit SwapEndian variants, as they're still reasonably simple
git-svn-id: trunk@36304 -
2017-05-23 07:32:54 +00:00
pierre
ded1fb23a2 Improve stack trace output with -Cr option, contributed by Colin Western
git-svn-id: trunk@36134 -
2017-05-06 13:54:50 +00:00
pierre
d2d1794b40 Use HandleError instead of RunError in fpc_help_destructor, fpc_check_object and fpc_check_object_ext
git-svn-id: trunk@36113 -
2017-05-05 11:49:16 +00:00
nickysn
b14f277e8f + use rtl helpers for 64-bit shl/shr/sar/rol/ror modify in place operations, on
platforms that don't have native 64-bit implementation of the corresponding
  64-bit shift/rotate operation

git-svn-id: trunk@35787 -
2017-04-13 15:24:32 +00:00
florian
86f0b59095 * avoid conversion to larger type in Align
git-svn-id: trunk@34940 -
2016-11-20 19:02:53 +00:00
pierre
b9e6938519 Correct behavior: if VMT becomes NIL, RTE 219 must be generated as this happens if EXPVMT is not an ancestor of starting VMT
git-svn-id: trunk@34197 -
2016-07-24 06:13:46 +00:00
svenbarth
59303c5113 Fix -CR after the recent VMT changes.
* tobjectvmt: parent needs to be ppointer for 3.1.1
* fpc_check_object_ext: correctly determine parent VMT

git-svn-id: trunk@34194 -
2016-07-23 16:42:15 +00:00
florian
2b082d88a6 * generic implementation of fpc_pchar_length uses IndexByte instead of a simple while loop
git-svn-id: trunk@33490 -
2016-04-12 18:11:27 +00:00
florian
91c59cb512 * fix Fill* code for CPUs with 8 Bit ALU
git-svn-id: trunk@32645 -
2015-12-12 15:49:51 +00:00
nickysn
db7b743139 * yet another longint replaced with objpasint in fpc_shortstr_compare_equal
git-svn-id: trunk@32098 -
2015-10-19 16:53:40 +00:00
nickysn
b561b3c2ba * use objpasint (generates better code on 16-bit and 8-bit cpus) instead of
longint in several generic shortstr helpers

git-svn-id: trunk@32097 -
2015-10-19 16:36:12 +00:00
florian
590ec0f3e6 * more procedures excluded to avoid internalerrors on avr after the trgobj.conservative fix
git-svn-id: trunk@31440 -
2015-08-28 18:49:07 +00:00
florian
ba1297b1ab + provide also 8 and 16 bit div/mod helper
* tmoddivnode.first_moddivint does not force a 32 bit helper, the used helper depends now on the resultdef type set by tmoddivnode.pass_typecheck

git-svn-id: trunk@31195 -
2015-07-05 20:16:50 +00:00
Jonas Maebe
b4033efc00 * fixed typo in comment
git-svn-id: trunk@30079 -
2015-03-02 21:45:43 +00:00
Jonas Maebe
ff020a3be4 + "Utf8CodePointLen(pansichar,MaxLookAhead,IncludeCombiningDiacriticalMarks):
sizeint"  function that returns:
   <0: invalid sequence detected after processing "-result" bytes
   0:  incomplete (may still be valid if MaxLookAhead is increased)
   >0: sequence of result bytes forms a codepoint (+ combining diacritical
       marks if that parameter was true)

git-svn-id: trunk@30047 -
2015-03-01 17:12:17 +00:00
Károly Balogh
05e72f52c6 a slightly better generic implementation for SwapEndian() 32 bit and 64 bit ints
git-svn-id: trunk@28614 -
2014-09-07 23:19:57 +00:00
sergei
98332db7fe * Improved generic implementations of Bsf/Bsr. Existing ones were just ugly, BsfQword/BsrQWord producing total of 15 inline expansions 5 levels down and bloating into just a little less than a kilobyte of code (on MIPS). Now it is at most 3 expansions and 21 instructions (84 bytes), 16 and 32 bit routines are branchless.
git-svn-id: trunk@28575 -
2014-09-01 16:00:33 +00:00