Re: [fpc-devel] Overflow in TMemoryStream?

2016-09-11 Thread Martok
Hi, yes, I can confirm this as an overflow, but on its own, it should be safe. Above 430MB, the stream doesn't grow by a quarter but just by however much was requested, luckily the branch fails before the wrong capacity could be set. Test: type TMS2 = class(TMemoryStream) end; var ms: TMS2;

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jonas Maebe
On 11/09/16 15:11, Jeppe Johansen wrote: Here's an ARM version that runs in 5 cycles on a Cortex A8: movr2,r1,lsr #5 movr12,#1 ldrr3,[r0, r2, lsl #2]! orrr2,r3,r12,lsl r1 strr2,[r0] andr0,r12,r3,lsr r1 It's one cycle faster than what the compiler c

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jeppe Johansen
On 09/08/2016 11:02 AM, Jy V wrote: Hello to all assembler experts, I would greatly appreciate if some people could help me prepare some asm code for FreePascal for Win32, Win64, Linux x86, Linux x64 (and maybe some ARM32bit + AARCH64) I am using Lazarus 1.6, FPC 3.0.0 SVN revision 51630 x86_

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jy V
Thank you Thomas, I will experiment with {$ASMMODE INTEL} On Sunday, September 11, 2016, Tomas Hajny wrote: > On Sun, September 11, 2016 09:43, Jy V wrote: >> Thank you Jonas, >> so back to my original question, >> is there an asm expert out there who knows if the syntax is invalid, or >> simply

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Tomas Hajny
On Sun, September 11, 2016 09:43, Jy V wrote: > Thank you Jonas, > so back to my original question, > is there an asm expert out there who knows if the syntax is invalid, or > simply the compiler does not implement bt, bts, btr instructions . . In general, GNU assembler syntax requires you to sp

[fpc-devel] Overflow in TMemoryStream?

2016-09-11 Thread Martin Schreiber
Hi, While working on the MSEgui fork of classes unit I saw a suspect piece of code in streams.inc: " function TMemoryStream.Realloc(var NewCapacity: PtrInt): Pointer; begin If NewCapacity<0 Then NewCapacity:=0 else begin // if growing, grow at least a quarter if (NewCapac

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jy V
Thank you Jonas, so back to my original question, is there an asm expert out there who knows if the syntax is invalid, or simply the compiler does not implement bt, bts, btr instructions function BitsetGet(const Bits; Index: UInt32): Boolean; assembler; asm {$IFDEF WIN64} // Win64 IN: rcx = Bi