dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

long && LOWORD | HIWORD

 
dev.gamez.lv Forum Index -> Programmēšana
View previous topic :: View next topic  
Author Message
Angel



Joined: 02 Jan 2005
Posts: 113
Location: Latvija

PostPosted: Sun Aug 14, 2005 1:50 pm    Post subject: long && LOWORD | HIWORD

kaa es pac vareetu noteikt HI & LOWORD longam -> man tas ir vaidziigs prieksh WM_SIZE -> kur LO atbild par width un HI - height
_________________
Back to top
View user's profile Send e-mail
gazz



Joined: 03 Jan 2004
Posts: 355
Location: Teika

PostPosted: Sun Aug 14, 2005 2:37 pm    Post subject:

long zumm;
loword = (zumm&0xFFFF)
hiword = ((zumm>>16)&0xFFFF)

man shkiet ka bija shitaa Smile)) labojat ja kljuudos

vai arii vienkaarshi vari izmantot jau macros LOWORD(long) un HIWORD(long). vismaz visual c++ jamie pieejami peec windows.h includoshanas
Back to top
View user's profile Send e-mail
Angel



Joined: 02 Jan 2005
Posts: 113
Location: Latvija

PostPosted: Sun Aug 14, 2005 4:18 pm    Post subject:

emm, srry - nepareizi pajautaaju Embarassed

taa, meeginaashu veelreiz - es gribeetu pac noteikt (t.i. kaadiem jaabuut) LO un HI WORD nevis uzzinaat kaadi ir

P.S. cerams ka saprataat ko es gribeeju Confused
_________________
Back to top
View user's profile Send e-mail
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Sun Aug 14, 2005 4:31 pm    Post subject:

Tev vajag uzkonstruēt to long no wordiem?
Code:
long zumm = hiWord<<16 | loWord;
Back to top
View user's profile Send e-mail
Angel



Joined: 02 Jan 2005
Posts: 113
Location: Latvija

PostPosted: Sun Aug 14, 2005 4:59 pm    Post subject:

iespeejams, ka tas ir tas kas vajadziigs, jaacer, ka straadaas
_________________
Back to top
View user's profile Send e-mail
BHC
Guest





PostPosted: Sun Aug 14, 2005 10:28 pm    Post subject:

Code:

long zumm;
loword = (zumm&0xFFFF)
hiword = ((zumm>>16)&0xFFFF)

hiword = zumm>>16; nav nepieciešams and'ot, lieka operācija.
Vēlviens veids kā dabūt loword:
loword = zumm<<16>>16; velk uz makaron-kodu.
Back to top
Vecais_Dumais_Laacis
Guru
Guru


Joined: 29 Jan 2004
Posts: 800

PostPosted: Mon Aug 15, 2005 7:54 am    Post subject:

BHC: moka labaak tomeer ir ANDot - paturot praataa 64bit sisteemas jaukumus kur long ir 64bit integeris?
_________________
...un ja bites buutu laachi...
Back to top
View user's profile
BHC
Guest





PostPosted: Mon Aug 15, 2005 1:53 pm    Post subject:

Hm... Drošības pēc varbūt labāk ir noand'ot.

Tomēr:
* ja mainīgais hiword ir definēts kā 2baiti, tādēļ tur tā pat nevar ielīst iekšā kaut kas lieks.
* mainīgajā zumm tāpat būs reāli tikai 4baiti informācija un jaunajos četros baitos tur nevajadzētu rasties mistiskām vērtībām.
* long aizstāt ar int, jo int paliek 32biti arī uz 64bitu sistēmas.
Labojiet, ja kļūdos.

Laikam šī ir zīme, ka man vajadzētu iegādāties 64bitu proci. Smile
Back to top
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Mon Aug 15, 2005 2:45 pm    Post subject:

Man liekas tieši int ir native procesora vārds (16-bitu DOSā, tas bija 2 baiti, Win32'ā tas ir 4 baiti, un uz win64 droši vien 8 baiti). Turpretī long ir fiksēts 4 baiti (arī 16-bit dosā).
Back to top
View user's profile Send e-mail
elvman
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 09 Apr 2003
Posts: 1278
Location: Kuldiga

PostPosted: Tue Aug 16, 2005 10:30 pm    Post subject:

Nee. Arii long lielums ir atkariigs no procesora.

Quote:
DWORD32 32-bit unsigned integer
DWORD64 64-bit unsigned integer
INT32 32-bit signed integer
INT64 64-bit signed integer
LONG32 32-bit signed integer
LONG64 64-bit signed integer
UINT32 Unsigned INT32
UINT64 Unsigned INT64
ULONG32 Unsigned LONG32
ULONG64 Unsigned LONG64

Quote:
The int type is equivalent to either the short int or the long int type, and the unsigned int type is equivalent to either the unsigned short or the unsigned long type, depending on the target environment

_________________
long time; /* know C */
Back to top
View user's profile Visit poster's website
Vecais_Dumais_Laacis
Guru
Guru


Joined: 29 Jan 2004
Posts: 800

PostPosted: Wed Aug 17, 2005 8:36 am    Post subject:

BHC: es to domaaju tieshi par piemeeru kur bija dots long zumm; - long nokompileesies kaa 64bit longs uz 64bit sisteemas.
vienk
hiword = zumm>>16; pie nosaciijuma ja zumm lielaaks par 0x00000000FFFFFFFF radiis ne to skaitli ko gribi ieguut jo hiwords tiks castots no taa pasha nobiidiitaa 64bit longa.

Quote:
* long aizstāt ar int, jo int paliek 32biti arī uz 64bitu sistēmas.


tas ir vislabaakais veids - kopsh saskaaros ar 64bit kompilieriem taa saaku lietot defineetus mainiigo tipus kaa uint32 utt. un paliidz Wink
_________________
...un ja bites buutu laachi...
Back to top
View user's profile
Display posts from previous:   
dev.gamez.lv Forum Index -> Programmēšana All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group