News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

filename from path

Started by zemtex, April 24, 2012, 07:29:57 PM

Previous topic - Next topic

zemtex

It's funny to see it went from "Don't need it" to "I can make it faster". I find it ridiculously easy to see the inconsistencies.  :lol
I see this inconsistency in both of you, and it is a strange shift.

Keep in mind

1: It was not a speed issue.
2: My code was laid out in 30 seconds, no testing, no preparations, (not 2 days of preparations in Olly)
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

jj2007

Quote from: qWord on April 27, 2012, 09:49:20 PM
ABI-friendly, 18 Bytes, no sting instructions

It was not my intention to sting you, qWord :wink

Ok, 3 bytes shorter and 0.15 instead of 0.27 seconds per Million strings parsed :U
More offers?
Prost :bg

zemtex

(.... just keeping it going, everything is normal...)

I sometimes find people more interesting than programming  :bg
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

hutch--

 :bg

The only thing missing in this discussion on algorithm design is a registry check for a valid activated version of Windows followed by a secret internet connection to "big brother" to ensure that the paths use politically correct terminology.

I mean HAY !!!! where do you find a million paths in a hurry on any single computer and if you did, why would you need to parse them faster than disk IO ?

About the only reason I can think of to write even vaguely optimised code for such a simple task is so you don't end up with cache pollution using old junk instructions in the middle of fast stuff.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Quote from: hutch-- on April 27, 2012, 11:05:53 PM...cache pollution using old junk instructions in the middle of fast stuff.

That sounds almost esoteric, Hutch :boohoo:

Howz the red wine down under? My bottle of Primitivo is getting lighter and lighter now... after a long fight with Masm's macro engine :bg

dedndave

i tend to think more along the lines of flexibility
for this kind of routine - the more ways i can use it, the better
mine starts off like this....
ParseFileName PROTO :LPSTR,:UINT

;******************************************************************

        OPTION  PROLOGUE:None
        OPTION  EPILOGUE:None

ParseFileName PROC lpszPathName:LPSTR,uLength:UINT

;Parse File Name String - DednDave - 4, 2012
;
;  Used to seperate a fully qualified path string.
;
;Example:
; szPathName = 'C:\Masm32\Macros\Macros.asm',0
;
;After the call, EAX will point to: 'Macros.asm',0
;                ECX will point to: 0
;                EDX will point to: 'asm',0
; ECX may be used to calculate string lengths
; if no '\', '/', or ':' is found, EAX = lpszPathName
; if no '.' is found, EDX points to the null terminator
; only periods after the beginning of the file name are considered
; i.e. EDX is always greater than EAX, unless the path is null
;
;Call With: lpszPathName = address of zero-terminated path string
;                uLength = string length,
;             if uLength = NULL, the routine will find the length
;
;  Returns: EAX = address of possible filename string
;           ECX = address of null terminator
;           EDX = address of possible filename extension string
;
;Also Uses: all other registers are preserved
;
;----------------------------------------------

        push    esi
        mov     eax,[esp+12]     ;EAX = uLength
        mov     esi,[esp+8]      ;ESI = lpszPathName
        or      eax,eax
        jnz     PFile0

        INVOKE  StrLen,esi

PFile0: add     eax,esi          ;EAX = index

hutch--

JJ,

Pure malt man myself, we call primitive red wine "rough red" and while I know a few people who have the intestinal fortitude to consume such beverages, I am not one of them, almost all wines make me sick so I stick to the straight and narrow and only drink very pure spirits, albeit in extreme moderation.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

xandaz