flat assembler
Message board for the users of flat assembler.

Index > Main > 8Byte lsb to 1Byte

Author
Thread Post new topic Reply to topic
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 10 Aug 2022, 07:37
What is the shortest? What is the fastest?
Post 10 Aug 2022, 07:37
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1852
Roman 10 Aug 2022, 08:27
Fastest is bit Smile
Post 10 Aug 2022, 08:27
View user's profile Send private message Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 10 Aug 2022, 08:47
shl al,7
;shr al,7
;shl al,7
shl ah,7
shr ah,7
shl ah,6
shl bl,7
shr bl,7
shl bl,5
shl bh,7
shr bh,7
shl bh,4
shl cl,7
shr cl,7
shl cl,3
shl ch,7
shr ch,7
shl ch,2
shl dl,7
shr dl,7
shl dl,1
shl dh,7
shr dh,7
add ah,al
add bh,bl
add ch,cl
add dh,dl
add bh,ah
add dh,ch
add dh,bh
mov [edi],dh
add edi,1

Shorter, faster solution?


Last edited by Fastestcodes on 10 Aug 2022, 11:39; edited 1 time in total
Post 10 Aug 2022, 08:47
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 670
Location: Ukraine
Overclick 10 Aug 2022, 09:14
Post 10 Aug 2022, 09:14
View user's profile Send private message Visit poster's website Reply with quote
f2065



Joined: 01 Jan 2012
Posts: 16
Location: Russia,Moscow
f2065 10 Aug 2022, 10:38
Fastestcodes wrote:
add dh,bh
mov dh,[edi]
?


Fastestcodes wrote:
Shorter, faster solution?
Code:
and ax, 0x0101
and bx, 0x0101
and cx, 0x0101
and dx, 0x0101
shl al, 7
shl ah, 6
or al, ah
shl bl, 5
or al, bl
shl bh, 4
or al, bh
shl cl, 3
or al, cl
shl ch, 2
or al, ch
shl dl, 1
or al, dl
or al, dh    
Post 10 Aug 2022, 10:38
View user's profile Send private message Visit poster's website Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 10 Aug 2022, 10:53
Thx!
Code:
mov al,1
mov ah,1
mov bl,1
mov bh,1
mov cl,1
mov ch,1
mov dl,1
mov dh,1
shl al,7
shl ah,7
shr ah,1
shl bl,7
shr bl,2
shl bh,7
shr bh,3
shl cl,7
shr cl,4
shl ch,7
shr ch,5
shl dl,7
shr dl,6
shl dh,7
shr dh,7
add ah,al
add bh,bl
add ch,cl
add dh,dl
add bh,ah
add dh,ch
add dh,bh
mov ]edi],dh
add edi,1
    


Last edited by Fastestcodes on 10 Aug 2022, 11:29; edited 1 time in total
Post 10 Aug 2022, 10:53
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 10 Aug 2022, 11:20
Code:
        mov     rax,0101010101010101h
        and     rax,qword [input]
        mov     rdx,0102040810204080h
        mul     rdx
        shr     rax,64-8 ; extract the result from the highest byte    


Fastestcodes wrote:
How can I write to code window?
Use [code] [/code] tags.
Post 10 Aug 2022, 11:20
View user's profile Send private message Visit poster's website Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 10 Aug 2022, 11:31
Thx Tomasz!
Post 10 Aug 2022, 11:31
View user's profile Send private message Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 10 Aug 2022, 12:46
F2065 code with less al use
Code:
and ax,0101h
and bx,0101h
and cx,0101h
and dx,0101h
shl al, 7
shl ah, 6
shl bl, 5
shl bh, 4
shl cl, 3
shl ch, 2
shl dl, 1
or al,ah
or bl,bh
or cl,ch
or dl,dh
or al,bl
or cl,dl
or al,cl
mov [edi],al
    

Thx all! <3
Post 10 Aug 2022, 12:46
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2572
Furs 10 Aug 2022, 13:07
Code:
pext rax, rax, 0101010101010101h    
Post 10 Aug 2022, 13:07
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1852
Roman 10 Aug 2022, 15:02
Pext cool!
Post 10 Aug 2022, 15:02
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1852
Roman 10 Aug 2022, 15:11
What about Ibts?
Wikipedia write this is insert bit in string.
Post 10 Aug 2022, 15:11
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 10 Aug 2022, 16:16
Roman wrote:
What about Ibts?
Wikipedia write this is insert bit in string.
XBTS/IBTS were the 80's precursors of PEXT/PDEP, but only specific models of 80386 had them.
Post 10 Aug 2022, 16:16
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.