Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Components Misc > Re: Conversion ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 215 of 251
Post > Topic >>

Re: Conversion Delphi / VB

by "Terry Russell" <trochilus@[EMAIL PROTECTED] > Dec 2, 2005 at 07:05 AM

"Nige" <nkarnold@[EMAIL PROTECTED]
> wrote in message
news:Nkzjf.110669$Es4.109854@[EMAIL PROTECTED]
> Hello.
>
> Can anyone help me with the Dephi function below...
>
> const  CC_TIME = $3f;

byte mask

>
> procedure TvStripForm.AddTime(var sum: array of Byte; b: array of Byte);
> var
>   i: Integer;
>   max_f: Integer;
> begin
>   for i := Low(sum) to High(sum) do

  lowest index of s highest index of s

>     Inc(sum[i], (b[i] and CC_TIME));

   logical and with mask of byte b[i]
   add it to sum[i]
   ( there could probably be some sanity checks, or code assumes
     these checks have been made at calling level
    dunno why the dynamic arrays and indexes, the rest only operates on 4
bytes
    that could pass as a native
    )

>   max_f := 25;
>   if ((b[3] and (not CC_TIME_)) = 192) then
>     max_f := 30;

   invert cc_time  , logical and with byte b[3]
 if it is same as byte 192  then max_f=25 otherwise no change

>
>   if (sum[3] >= max_f) then begin
>     Dec(sum[3], max_f);
>     Inc(sum[2]);
>   end;

add with carry , ripple changes

>   if (sum[2] >= 60) then begin // seconds
>     Dec(sum[2], 60);
>     Inc(sum[1]);
>   end;
>   if (sum[1] >= 60) then begin // minutes
>     Dec(sum[1], 60);
>     Inc(sum[0]);
>   end;
> end;
>
>
> I wan't to create the same function in Visual Basic, but Im struggling,
as
I
> don't really know Delphi all that well.  We dont intend to leave Delphi
> behind, someone in our department wants to see if VB tackles the above
> function, as he thinks it will be a much long winded away around..
> personally I dont think it will.

What I know about VB is locked in a little mental rubber room
and classified never to be released.
probably not much difference, 'tis fairly simple code, basic even :-)

and not worth much when considering development environments,
they manage code layouts and debugging  , not bit twiddling
 




 4 Posts in Topic:
Conversion Delphi / VB
"Nige" <nkar  2005-12-01 09:26:05 
Re: Conversion Delphi / VB
"Terry Russell"  2005-12-02 07:05:48 
Re: Conversion Delphi / VB
Erik <erikpub@[EMAIL P  2005-12-02 09:49:32 
Re: Conversion Delphi / VB
Erik <erikpub@[EMAIL P  2005-12-02 09:52:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 18:29:28 CDT 2008.