Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

simple math issue

Featured Replies

Posted

hello tuts4you, i got a simple math question.


 


when a lenght of a string divisible by 36, the counter should be added by 10.So i got this working but i bet there is a better/cleaner way to do this.


 


 


this is what i got and it works, but could someone help me to improve my function?



invoke lstrlen, Addr szString
.if eax <= 36
push 10
.elseif eax <= 72 ; + 36
push 20 ; + 10
.elseif eax <= 108 ; + 36
push 30 ; + 10 etc..
.elseif eax<= 144
push 40
.elseif eax <= 180
push 50
.elseif eax <= 216
push 60
.elseif eax <= 252
push 70
.else
push 80
.endif

Modulo operation


 


ASM DIV look EDX == 0?


// -- divide length by 36, add one

CDQ

MOV ECX,24h

DIV ECX

INC EAX

// -- if result is more than 8, set it to 8

CMP EAX,8

JBE @F

MOV EAX,8

@@:

// -- multiply result by 10, in EAX will be the value we need

MOV ECX,0Ah

MUL ECX

  • Author

again tuts4you helped me out, a LOT of thanks kao and Aguila, problem solved :D


Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.