Jump to content

Anders Melander

Members
  • Content Count

    2563
  • Joined

  • Last visited

  • Days Won

    134

Everything posted by Anders Melander

  1. Anders Melander

    Delphi and "Use only memory safe languages"

    Do you really want your code to be generated based on fuzzy statistics? How do you even verify the correctness of the results? I'd like mine to be based on strict patterns and known deterministic properties of those patterns. I think trying to solve these problems with AI is a bit like when some companies moves their stuff to the cloud; They don't understand how it works or know what is going on but now it's somebody else's problem.
  2. I have it and many of the techniques in it that were great 10-15 years ago are totally unnecessary today and even detrimental with modern CPUs. It's still a good read and even though some techniques are obsolete, knowing them can help solving other similar problems simply because they can make you think about problems differently. Um... Always? There used to be a time, not that long ago, when integer math was far superior to floating point math (see: Hackers Delight). Not so anymore. via https://stackoverflow.com/questions/2550281/floating-point-vs-integer-calculations-on-modern-hardware The video is a bit long so I haven't watched it yet, but it's LEA: Load Effective Address, "LEAL" is AT&T syntax for LEA (Intel syntax). Here's a good comment on the topic by Peter Cordes: Using LEA on values that aren't addresses / pointers? Before you start replacing all your shifts with LEA you should be aware that it isn't always faster. As with almost everything in modern CPUs it depends on what the CPU is otherwise busy with. https://stackoverflow.com/questions/70316686/assembly-why-is-lea-eax-eax-eaxconst-shl-eax-eax-const-combined-fast
  3. Anders Melander

    New quality portal for bugs is open

    The ability to at least filter on Components would be nice so one can focus on areas of interest. I don't know if that is possible though... https://jira.atlassian.com/browse/JSDCLOUD-1106 https://jira.atlassian.com/browse/JSDCLOUD-4384 https://jira.atlassian.com/browse/JSDCLOUD-4356 Knowing Atlassian, If it isn't possible then it'll stay that way.
  4. Anders Melander

    12.1 requiring me to uninstall 12.0?

    Yes, I did that the third time. I just wish they would remember my choices going from 12.0 to 12.1; It's hardly rocket science...
  5. Anders Melander

    Delphi Low-code No-code?

    Again? What was old is new again - except my jokes.
  6. Anders Melander

    12.1 requiring me to uninstall 12.0?

    Just answer No to the question "Do you want to remove all RAD Studio 12 entries from your registry?" and you should be fine (depending on your definition of "fine"). The Delphi installer has always been a case study in poor usability. This time it took me 4 tries before I got everything I wanted installed. First time I forgot to change the install location. I do this pretty much every other time. Second time I installed Android platform support but didn't select to also install the (apparently required) JDK. Third time I discovered that since didn't explicitly select to install Windows platform support, I only got the 32-bit compiler.
  7. Anders Melander

    NEW INDY REPO (CLONE) FOR ATHENS 12.1 UPDATES

    That's not how you do it. I doubt Remy will have time or motivation to look at whatever it is you have done. Fork the original repository. Make a branch. Apply your changes. Create a pull request to have your changes merged into the original repository. 2-4 should be done once per separate issue. A single issue that makes 20 unrelated changes probably has zero chance of being accepted.
  8. Anders Melander

    Delphi 12.1 is available

    That would have had zero impact on their self-hosted Jira since its support expired 7 years ago anyway. I'm not saying I don't understand why they would want to migrate to something else, but the reason you state ain't it.
  9. Anders Melander

    Delphi 12.1 is available

    The new Atlassian slogan
  10. Anders Melander

    Delphi 12.1 is available

    Yes, I fear it will. While I haven't used it yet and there's presently nothing there, I'm really afraid this just wiped out yet another small community. Tick tock, tick tock.
  11. Anders Melander

    Delphi 12.1 is available

    aaaaaaaand it sucks. But at least, from reading the announcement, it appears they know it sucks.
  12. Anders Melander

    Delphi 12.1 is available

    You have been able to do that in Delphi for 10-15 years - Just not with both editors docked.
  13. Anders Melander

    Do you need an ARM64 compiler for Windows?

    With in-process COM you'd have all the same problems without any of the benefits of the BPL/DLL packages. With out-of-process COM you'd have the benefit of process separation but you would have to surface the whole TControl and design-time API bidirectionally. It would be a nightmare. Also each process would contain their own linked-in copy of the RTL/VCL. And forget about shoehorning this into the existing IDE; It would have to be rewritten from scratch. No thanks.
  14. Anders Melander

    Do you need an ARM64 compiler for Windows?

    Yes, that much was clear. So how do you accomplish that?
  15. You can use OpenCV on Android and iOS. Haven't you researched this at all?
  16. Anders Melander

    Do you need an ARM64 compiler for Windows?

    No more than any other major upgrade of Delphi. How would you have designed the system then?
  17. Anders Melander

    globalSize()

    I think you can safely assume that: GlobalSize returns the correct size. Any additional memory it might return (which I don't believe it will) will be zeroed. I've been working with drag/drop and the clipboard through COM for 25 years and none of my tools has any handling of extra data and they assume that GlobalSize returns the requested size (which is has so far).
  18. Anders Melander

    globalSize()

    GlobalSize isn't useless just because it doesn't behave the way you want it to or expect it to. From what I can tell you can only rely on the returned size to be >= requested size. Regardless of whatever it might return right now on your system. That said, I can't remember having GlobalSize return a value I didn't expect - but I might also just have forgotten about it. Anyway, if you are reading data from the clipboard then you can try to request the TYMED_ISTREAM medium instead of TYMED_HGLOBAL. If you are lucky the returned IStream will report the correct size. I doubt it though; I think the IStream is just a wrapper around a HGLOBAL.
  19. Anders Melander

    globalSize()

    What mistake is that? It's by design. Did you not read the articles you linked to?
  20. Anders Melander

    Regression - Delphi 12 - IsZero()

    Opinions are easy. Code... a bit harder.
  21. Anders Melander

    Bug in TButton with Multi-Line Caption?

    One did
  22. Anders Melander

    x87 vs SSE single truncation

    So I have the following function which is supposed to truncate a Single using the SSE CVTTSS2SI instruction. Pretty simple except for all the MXCSR fluff. Yes, I know I could just use the SSE4.1 ROUNDSS instruction, which does all of the below in a single instruction, but that's not relevant to this. Anyway, the problem is that my function doesn't always agree with System.Trunc (which is implemented with the x87 instruction FISTP). I guess that is to expected in some case due to the difference in precision (80 vs 32 bits) but as far as I can tell that is not the problem I'm encountering here - and I would also only expect it to manifest as a problem in rounding and not truncation. Specifically I have the value -2343.5 System.Trunc(-2343.5) = -2343 FastTrunc(-2343.5)=-2344 Given that truncation is supposed to round towards zero, I believe that System.Trunc is correct. But then why is CVTTTSS2SI not doing that? function FastTrunc_SSE2(Value: Single): Integer; var SaveMXCSR: Cardinal; NewMXCSR: Cardinal; const // SSE MXCSR rounding modes MXCSR_ROUND_MASK = $FFFF9FFF; MXCSR_ROUND_NEAREST = $00000000; MXCSR_ROUND_DOWN = $00002000; MXCSR_ROUND_UP = $00004000; MXCSR_ROUND_TRUNC = $00006000; asm XOR ECX, ECX // Save current rounding mode STMXCSR SaveMXCSR // Load rounding mode MOV EAX, SaveMXCSR // Do we need to change anything? TEST EAX, MXCSR_ROUND_DOWN JNZ @SetMXCSR TEST EAX, MXCSR_ROUND_UP JZ @SkipSetMXCSR // Skip expensive LDMXCSR @SetMXCSR: // Save current rounding mode in ECX and flag that we need to restore it MOV ECX, EAX // Set rounding mode to truncation AND EAX, MXCSR_ROUND_MASK OR EAX, MXCSR_ROUND_TRUNC // Set new rounding mode MOV NewMXCSR, EAX LDMXCSR NewMXCSR @SkipSetMXCSR: {$if defined(TARGET_x86)} MOVSS XMM0, Value {$ifend} // Round/Trunc CVTSS2SI EAX, XMM0 // Restore rounding mode // Did we modify it? TEST ECX, ECX JZ @SkipRestoreMXCSR // Skip expensive LDMXCSR // Restore old rounding mode LDMXCSR SaveMXCSR @SkipRestoreMXCSR: end;
  23. Anders Melander

    A gem from the past (Goto)

    True, but don't say that out loud. sEE, i'M uSiNg GoToS; iM A hiGhLy SkIlLeD pRoGraMmEr!
  24. Anders Melander

    x87 vs SSE single truncation

    Sounds like premature optimization 🙂 I'm doing graphics so memory bandwidth is always going to be a bottleneck. The first goal then is to use the correct algorithms and update as little as possible (thus minimizing the impact of that bottleneck) and then do everything else as fast as possible. Round and Trunc are used a lot for some operations and while replacing them with something faster might not yield much in most situations they are significant components in some performance scenarios. Also, my goal wasn't really to create a killer Round/Trunc function. I just wound up there because I needed to isolate the functionality when it didn't behave as I expected.
  25. Anders Melander

    x87 vs SSE single truncation

    No. I'm working in Single precision so there's no type conversion going on. That said, I have implemented overloads for both Single and Double and the single and double instructions performs exactly the same.
×