Author: Aliaksandr Hryshyn
0 Views
0 Downloads
0 Favorites
Test_cBool
ÿþ//+------------------------------------------------------------------+

//|                                                   Test_cBool.mq5 |

//|                                               Aliaksandr Hryshyn |

//|                          https://www.mql5.com/ru/users/greshnik1 |

//+------------------------------------------------------------------+

#property copyright "Aliaksandr Hryshyn"

#property link      "https://www.mql5.com/ru/users/greshnik1"

#property version   "1.00"

#include <cBool.mqh>

//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void OnStart()

  {

   cBit_thread thread(8*1024*1024);

   ulong mcs=GetMicrosecondCount();

   ulong num=0x1122334455667788;

   for(int i1=0; i1<10*1024*1024; i1++)

     {

      thread.Write(num,(i1%6)*8,16);

     }

   Print("10*1024*1024 70?8A59 ",(GetMicrosecondCount()-mcs)/1000.0," <A");

   mcs=GetMicrosecondCount();

   thread.Seek(0,SEEK_SET);

   for(int i1=0; i1<10*1024*1024; i1++)

     {

      thread.Read(num,i1%8,i1%44);

     }

   Print("10*1024*1024 GB5=89 ",(GetMicrosecondCount()-mcs)/1000.0," <A");



   struct sNm

     {

      ulong          i2[2];

     };

   thread.Seek(0,SEEK_SET);

   sNm num2;

   num2.i2[0]=0x1122334455667788;

   num2.i2[1]=0x9900aabbccddeeff;

   sNm numb2;

   mcs=GetMicrosecondCount();

   for(int i1=0; i1<1024*1024; i1++)

     {

      thread.Write(num2,i1%32,i1%96);

      thread.Write(num2,0,i1%32);

      thread.Write(num2,i1%32+i1%96);

      thread.Write(i1,0,5);

     }

   numb2.i2[0]=(ulong(MathRand())<<32)|MathRand();

   numb2.i2[1]=(ulong(MathRand())<<32)|MathRand();

   int err=0;

   thread.Seek(0,SEEK_SET);

   int i2;

   for(int i1=0; i1<1024*1024; i1++)

     {

      thread.Read(numb2,i1%32,i1%96);

      thread.Read(numb2,0,i1%32);

      thread.Read(numb2,i1%32+i1%96);

      thread.Read(i2,0,5);

      if((num2.i2[0]!=numb2.i2[0])||(num2.i2[1]!=numb2.i2[1])||((i2&31)!=(i1&31)))

         err++;

      numb2.i2[0]=(ulong(MathRand())<<32)|MathRand();

      numb2.i2[1]=(ulong(MathRand())<<32)|MathRand();

     }

   Print("@5<O B5AB8@>20=8O: ",(GetMicrosecondCount()-mcs)/1000.0," <A");

   Print("H81>: ?@8 B5AB8@>20=88= ",err);



   thread.Seek(0,SEEK_SET);

   uchar chr[];

   thread.Copy_to_array(chr,0,-1);

   thread.Copy_from_array(chr,0,-1,0);

  }

//+------------------------------------------------------------------+

Comments