whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

38 Visitors Online


 
...fastly retrieve the high-order word from 32bit var?
Autor: Martin
[ Print tip ]  

Tip Rating (6):  
     


The HiWord function retrieves the high-order word
from the given 32-bit value.

Instead of using HiWord(var32)

use: Word(var32 shr 16)

this is over 60% faster then calling HiWord() function.
Don't make procedure or function out of it (you'll kill the speed).

You could use Word(var32) over LoWord(var32)
but it's less then 1% faster.

********

Die HiWord Funktion extrahiert die das höherwertige Wort (Word) von einem
gegebenen 32-bit Wert.

Anstelle von HiWord(var32)
Verwende: Word((var32 shr 16)

Dies ist über 60% schneller als die HiWord() Funktion

Man könnte auch Word((var32) anstatt LoWord((var32) aber dies
ist weniger als 1% schneller.

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners