flat assembler
Message board for the users of flat assembler.

Index > Main > How to define a 128 bit variable?

Author
Thread Post new topic Reply to topic
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight
i was justwondering how to define a 128 bit var. i know 8 bit is db and 32 bit is dd and 80 bit is dt but how do i define 128 bits?
Post 02 Oct 2007, 10:30
View user's profile Send private message Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
do any of following:
Code:
var128bit db 16 dup 0

var128bit dw 8 dup 0

var128bit dd 4 dup 0

var128bit dq 2 dup 0
    

_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 02 Oct 2007, 13:04
View user's profile Send private message Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
Location: Severodvinsk, Russia
SFeLi
Code:
        label   var dqword
        rb      16
    
Post 02 Oct 2007, 14:32
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Xorpd!



Joined: 21 Dec 2006
Posts: 161
Xorpd!
Quote:


Code:

label var dqword
rb 16

Good one, but what if you want to write an initial value? This is not just a problem with FASM, but also with Intel's documentation. In 25366721.pdf sometimes a 128-bit quantity is written as subquantities, high subquantity leftmost, i.e. mixed big- and little-endian. Other times it is written as one 128-bit quantity, and other times it is left to the reader to guess which half goes where (as with palignr).

If the user wants to initialize 'var' to two qwords, the low qword would have to come first, backwards compared to what would be the norm in Intel's documentation. It would be neat if there were a way to make this less error-prone for the FASM user.
Post 02 Oct 2007, 15:01
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
128 bit is too much
16 bytes
2^128
very hudge
i don't see the utility
simply define a qword and an other just after

the idea of SFeLi is very good
you can build a macro

or asimply ask to tomasz to implement hbyte data type
Post 02 Oct 2007, 23:49
View user's profile Send private message Visit poster's website Reply with quote
FrozenKnight



Joined: 24 Jun 2005
Posts: 128
FrozenKnight
The reason i asked is because i'm working with very large prime numbers and their multipuls/powers. and was hoping to use 128 but definitions. (without having to spend hours breaking the number into binary.

Tomasz Grysztar could you please implement a data type for this purpose.
maybe a dqword or something?
Post 03 Oct 2007, 16:46
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 454
Location: Czech republic, Slovak republic
Feryno
microsoft uses "octaword" (or shortened form "oword") for 128-bit variable
so perhaps feature FASM syntax:
var128bit_initialized do 123456789ABCDEF00FEDCBA987654321h
var128bit_uninitialized do ?
var128bit_uninitialized ro 1
Post 04 Oct 2007, 08:24
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Guys, remember that fasm internally does works with 64-bit integers. By adding such features fasm internals should be improved first (or accept constants only for "do" while in "dq" you can do "label dq 2+4+assembly_time_variable*9/2").
Post 04 Oct 2007, 15:06
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
macro or implementation

the manner to build the 128bit value is not important
the goal is to have this value type

i think hbyte is a good name

cause hexa byte
very impressive!!! Wink

like goldorack or demolition man

and then RH and DH
and it cannot be a problem with Dh register because you never write
label dh x
or
dh x

so no syntax error
but a little of confussion for beginners

YEAH
Post 05 Oct 2007, 20:52
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
those are usually called "dqword" (native fasm size) or "oword" (my preference).

but as LocoDelAssembly wrote, fasm works only on 64bit constants internally.

Sure, you can build a macro that defines 16bytes by defining multiple bytes/words/dwords or qwords. That's quiet easy if the arguments of the macro are supposed to be in hexadecimal.

if you want the 16bytes to be defined in decimal, than you'll need a macro that does both number base converting and argument parsing, which is not trivial.
Post 28 Oct 2007, 01:09
View user's profile Send private message 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-2020, Tomasz Grysztar.

Powered by rwasa.