Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Conversion of a double variable to its high/low order word
#1
Is there any simple way to convert a double variable to its high and low order word. I need it to get the lang id and device handle for the physical layout of the keyboard, using GetKeyboardLayout.

Thank you in advance.
#2
Why double? Values containing hi/lo word usually are stored in int.

Macro Macro1526
Code:
Copy      Help
int i=0x00010002
int hi=i>>16
int lo=i&0xffff
out hi
out lo

int hilo=MakeInt(lo hi)
out "0x%08X" hilo

If need signed words:
Macro Macro1548
Code:
Copy      Help
int i=0xfffffffe
int hi=i>>16
int lo=i&0xffff

;unsigned word
out hi
out lo

;signed word (C short)
hi=ConvertSignedUnsigned(hi 2)
lo=ConvertSignedUnsigned(lo 2)
out hi
out lo
#3
Dear Gintaras,

Many thanks, Best personal regards,

Simos


Forum Jump:


Users browsing this thread: 1 Guest(s)