Skip to content
View in the app

A better way to browse. Learn more.

ResHax

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.
Help us keep the site running.

rounding off to the next nearest 0x100

Featured Replies

  • Author
  • Localization

happydance, posted Sun Apr 23, 2017 7:32 pm (22578)


not sure what it is really is called but id like to now how to achieve this by bms script

like if the size it 0xF2DA it will output 0xF300
or if the size it 0x3A2DA it will output 0x3A300


really not sure how to do this

this is my closest miserable attempt to make one but it's still wrong...


set SIZE long 0xF2DA
xmath TEST2 "(SIZE & 0xF00) 0x100"
xmath TEST3 "(SIZE & 0xF000) TEST2"


it will output 0xF300 but if I input like 0x2F300 it will still output 0xF300
  • Author
  • Localization

aluigi, posted Sun Apr 23, 2017 8:02 pm (22581)


math SIZE x 0x100

Yeah it's really that easy :D
  • Author
  • Localization

Acewell, posted Sun Apr 23, 2017 11:18 pm (22591)


here try this :D
Code:
set SIZE long 0x3A2DA
print "%SIZE|hex% :size"
xmath CHECK "SIZE % 256"
print "%CHECK|hex% :check"
if CHECK != 0
   xmath SIZE "(SIZE - CHECK) 256"
   print "%SIZE|hex% :new size"
endif
print "%SIZE|hex% :final size"
  • Author
  • Localization

aluigi, posted Mon Apr 24, 2017 8:28 am (22597)


@Acewell
Why? Isn't "math SIZE x 0x100" better?
  • Author
  • Localization

Vuze, posted Mon Apr 24, 2017 1:57 pm (22609)


.
Could you kindly paste the source code for the math x command? I'd like to port it to a C# tool I'm working on.
Lucky coincidence this showed up on my twitter feed yesterday when I ran into the problem :mrgreen:
  • Author
  • Localization

aluigi, posted Mon Apr 24, 2017 3:57 pm (22614)


var1 is the number to round and var2 is the alignment (for example 0x100):
Code:
if(var2 && ((u_int)var1 % (u_int)var2)) { var1  = (var2 - ((u_int)var1 % (u_int)var2)); }
  • Author
  • Localization

Vuze, posted Mon Apr 24, 2017 4:47 pm (22618)


Thank you!
  • Author
  • Localization

Acewell, posted Mon Apr 24, 2017 8:10 pm (22624)


aluigi wrote:
Isn't "math SIZE x 0x100" better?

oh wait, that "x" is a special operator isn't it?
i was thinking you meant "times", like 2 x 2 = 4 :)

first time i saw that "x" used, you never mentioned this solution to my "maintain a multiple of 4" problem here :P
viewtopic.php?f=13&t=3952

both ways work, but can you round down with your solution?
ah i see you have a "y" operator for that :)
  • Author
  • Localization

aluigi, posted Mon Apr 24, 2017 8:48 pm (22625)


Eh, when I see long posts I can't focus on them and, in that case I just focused only on the script you posted almost ignoring the rest :)

Anyway you can find all the operators in quickbms.txt, 'x' is there.
  • Author
  • Localization

happydance, posted Mon Apr 24, 2017 10:25 pm (22631)


thanks for the reply! gonna try some of the examples you guys gave.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

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.