This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format PE64 GUI 6.2 at 0x1234_56780000 | |
include 'mywin.inc' | |
GWL_EXSTYLE := -20 | |
TaskbarDemo: | |
iterate msg, WM_INITDIALOG,WM_COMMAND,WM_CLOSE | |
cmp edx,msg | |
jz .msg | |
end iterate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; kernel32.dll, advapi32.dll, 79 bytes | |
CheckElevation: | |
virtual at RBP-.FRAME | |
rq 4 | |
.P5 dq ? | |
.hTok dq ? ; HANDLE | |
.tLen dd ? | |
.tInfo TOKEN_ELEVATION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; with the remainder calculations can be split into pieces and extended later | |
calminstruction ROOT? result*, remainder*, N* | |
local rem, prox, bit, temp | |
compute rem, 0 | |
check N = 0 | |
jyes done | |
compute prox, 0 | |
compute bit, 1 shl (((bsr N) + 1) and -2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Create static bit vector: | |
; + ignore value set duplicates | |
; + invert value set when bit length is negative | |
struc(name) BITVECTOR bits,values& | |
local result,offset,char,inverted,_bits | |
virtual | |
offset = $ | |
db values ; string or byte array | |
result = 0 | |
while offset < $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; it's many forms and names ... | |
macro UUID line& | |
match A - B - C - D - E, line | |
dd 0x#A | |
dw 0x#B,0x#C | |
dq 0x#D#E bswap 8 | |
else match { A =, B =, C =, D { E } },line | |
dd A | |
dw B,C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Make data statements from file (don't use this - just use FILE directive). | |
calminstruction hex_nibble digit*, command: display | |
compute digit, 0FFh and '0123456789ABCDEF' shr (digit*8) | |
arrange command, command digit | |
assemble command | |
end calminstruction | |
define _db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; couldn't help myself after watching the video: | |
; https://www.youtube.com/watch?v=YMpdGLvqlrM | |
; (there is a better way, tomorrow perhaps) | |
; Euler's sum of powers conjecture. | |
; https://en.wikipedia.org/wiki/Euler%27s_sum_of_powers_conjecture | |
; | |
; It is unknown whether the conjecture fails or holds for any value k ≥ 6. | |
; | |
; Euler's conjecture was disproven by L. J. Lander and T. R. Parkin in 1966 when, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; references: | |
; https://branchfree.org/2018/05/22/bits-to-indexes-in-bmi2-and-avx-512/ | |
; https://lemire.me/blog/2018/03/08/iterating-over-set-bits-quickly-simd-edition/ | |
; http://0x80.pl/notesen/2019-01-05-avx512vbmi-remove-spaces.html | |
align 64 | |
; RCX : number of quadword to convert | |
; RSI : source bit array | |
; RDI : destination index array | |
bitmap_decode_ctz: | |
jrcxz .all_zero |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; All nearest smaller values, Barbay, Fischer & Navarro (2012) | |
; https://arxiv.org/abs/1009.5863 | |
; We assume an artificial overall minimum at [rsi] | |
; EAX: [0,N) | |
mov eax,1 | |
@0: lea edx,[rax-1] | |
add eax,1 | |
jmp @1 | |
@2: mov edx,[rdi+rdx*4] | |
@1: mov ecx,[rsi+rax*4-4] |