Need equivalent code for iBarshift either C++ or MQL4

 
Hi guys please if anyone can give me an equivalent code to iBarshift, the expanded version of the function so i can study it more deeply.It can be in any programming language you want just i need it to study it .Thanks ahead!
 
Proximus: anyone can give me an equivalent code to iBarshift, the expanded version of the function so i can study it more deeply. It can be in any programming language you want just i need it to study it.
  1. For current pair, current timeframe, exact=false
    equivalent to
    int iBarShift(datetime tm){ return( ArrayBsearch(Time, tm) ); }
    or
    int iBarShift(datetime tm){ 
     int iLimit = Bars - 1;
     for(int iBar = 0; iBar < iLimit; iBar++) if(Time[iBar] <= tm) break;
     return(iBar);
    }
  2. At https://www.mql5.com/en/forum/145041 I report that iBarShift doesn't match the documentation.
 
WHRoeder:
  1. For current pair, current timeframe, exact=false
    equivalent to
    or
  2. At https://www.mql5.com/en/forum/145041 I report that iBarShift doesn't match the documentation.

Thanks man, i`m very grateful!
Reason: