Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Im trying to convert bytes to kilobytes or megabytes and back again. I have these two functions:

 

Function DivideTimes(Byval number As Single, iterations As Integer) As Single

Dim x As Integer

 

For x = 1 to iterations

number /= 1024

Next

 

Return number

 

End Function

 

Function TimesTimes(ByVal number As Single, iterations As Integer) As Single

Dim x As Integer

 

For x = 1 to iterations

number *= 1024

Next

 

Return number

End Function

 

My question is, is there a more efficient way to do these functions? they just seem kinda clunky...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...