English
Source / code snippets

Bitfelder

 

Michael
W.
In XProfan can too with Bitfeldern works.

The simplest Operationen are here:
CompileMarkSeparation
Declare DasBitfeld&[250000]' 8.000.000 Bits

Proc Bitfield.Get

    Parameters BF&[], ix&
    Return if(TestBit( BF&[ix& \ 32], ix& mod 32) <> 0, 1, 0)

EndProc

Proc Bitfield.GetInv'liefert das invertierte Bit, ohne etwas zu ändern

    Parameters BF&[], ix&
    Return if(TestBit( BF&[ix& \ 32], ix& mod 32) <> 0, 0, 1)

EndProc

Proc Bitfield.Set'kann Bit setzen (=1) oder löschen (=0)

    Parameters BF&[], ix&, BitWert%
    BF&[ ix& \ 32] = SetBit( BF&[ix& \ 32], ix& mod 32, BitWert% )
    Return Bitfield.Get( BF&[], ix& )

EndProc

Proc Bitfield.Toggle

    Parameters BF&[], ix&
    '--- 'folgender 2-Zeiler ist kürzer, aber Index wird 3x neu errechnet
    'na gut, ist jetzt ein 1-Zeiler mit 2 Berechnungen
    '--- Return Bitfield.Set(BF&[],ix&,Bitfield.GetInv(BF&[],ix&))
    Declare AI&, BI%, NewBit%
    AI& = ix& \ 32' Array-Index
    BI% = ix& mod 32' Bit-Index
    NewBit% = if(TestBit(BF&[AI&],BI%)<>0,0,1)
    BF&[AI&] = SetBit(BF&[AI&],BI&,NewBit%)
    Return NewBit%

ENDPROC


it can but too several Bits with AND/OR/XOR machine go or whole Bitstreams (need one z.B. with Verschlüsselungen or Komprimierern).
 
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
01/20/15  
 



means instead of:

if(TestBit(BF&[AI&],BI%)<>0,0,1)


can You still simply:

TestBit(BF&[AI&],BI%)=0


write etc. or instead of:

if(TestBit( BF&[ix& \ 32], ix& mod 32) <> 0, 1, 0)


simply:

TestBit( BF&[ix& \ 32], ix& mod 32)<>0
 
01/20/15  
 




Michael
W.
Yes, wenn's still in the Help eindeutiger stood had.

with TestBit(x,1,1) had I 2 expects
with TestBit(x,2,1) had I 4 expects etc
because the are so The real Bitwerte.

now white I it through try...
 
XProfan X3
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
01/20/15  
 



No, with whom suggested Changes game it no role what in the Help standing.
 
01/21/15  
 




Michael
W.
Yes, have right. whom Test same as Ergebnislieferant benefit. these but not so eindeutig for all discernible. and it ought to Yes as small Beginner-Starthilfe serve...
 
XProfan X3
System: Windows 8/10, XProfan X4
Programmieren, das spannendste Detektivspiel der Welt.
01/21/15  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

7.471 Views

Untitledvor 0 min.
p.specht11/20/21
Uwe Lang11/20/21
Manfred Barei11/19/21
Wilfried Friebe11/17/21
More...

Themeninformationen

this Topic has 2 subscriber:

Michael W. (3x)
iF (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie