Checking if a number is prime in x64 Assembly
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm just learning Assembly. This program is a simple attempt to determine if a given number is prime or not. Any advice and all topical comments on code optimization and conventions is appreciated!
Compiled as follows using VS2017 x64 Native Tools Command Prompt
:
nasm -g -fwin64 isprime.asm
cl /Zi isprime.obj msvcrt.lib legacy_stdio_definitions.lib
isprime.asm
bits 64
default rel
extern printf
extern scanf
section .data
number: dq 0
isPrime: dq 1
counter: dq 0
question: db "Which number would you like to check? ", 0
fmt: db "%d", 0
numberIsPrime: db "%d is prime", 10, 0
numberIsNotPrime: db "%d is not prime", 10, 0
section .text
global main
main:
push rbp
mov rbp, rsp
sub rsp, 32
mov rcx, question
call printf
add rsp, 32
sub rsp, 32
mov rdx, number
mov rcx, fmt
call scanf
add rsp, 32
mov rcx, [number]
mov [counter], rcx
continue_prime_check:
dec qword [counter]
cmp qword [counter], 2
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:
mov rax, [number]
cdq
mov rbx, [counter]
idiv rbx
cmp edx, 0
je evenly_divisible
jmp not_evenly_divisible
evenly_divisible:
mov qword [isPrime], 0
not_evenly_divisible:
jmp continue_prime_check
prime_check_ended:
cmp qword [isPrime], 1
je number_was_prime
jmp number_wasnt_prime
number_was_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsPrime
call printf
add rsp, 32
jmp end_if
number_wasnt_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsNotPrime
call printf
add rsp, 32
end_if:
mov rbp, rsp
pop rbp
ret
primes assembly
New contributor
add a comment |Â
up vote
1
down vote
favorite
I'm just learning Assembly. This program is a simple attempt to determine if a given number is prime or not. Any advice and all topical comments on code optimization and conventions is appreciated!
Compiled as follows using VS2017 x64 Native Tools Command Prompt
:
nasm -g -fwin64 isprime.asm
cl /Zi isprime.obj msvcrt.lib legacy_stdio_definitions.lib
isprime.asm
bits 64
default rel
extern printf
extern scanf
section .data
number: dq 0
isPrime: dq 1
counter: dq 0
question: db "Which number would you like to check? ", 0
fmt: db "%d", 0
numberIsPrime: db "%d is prime", 10, 0
numberIsNotPrime: db "%d is not prime", 10, 0
section .text
global main
main:
push rbp
mov rbp, rsp
sub rsp, 32
mov rcx, question
call printf
add rsp, 32
sub rsp, 32
mov rdx, number
mov rcx, fmt
call scanf
add rsp, 32
mov rcx, [number]
mov [counter], rcx
continue_prime_check:
dec qword [counter]
cmp qword [counter], 2
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:
mov rax, [number]
cdq
mov rbx, [counter]
idiv rbx
cmp edx, 0
je evenly_divisible
jmp not_evenly_divisible
evenly_divisible:
mov qword [isPrime], 0
not_evenly_divisible:
jmp continue_prime_check
prime_check_ended:
cmp qword [isPrime], 1
je number_was_prime
jmp number_wasnt_prime
number_was_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsPrime
call printf
add rsp, 32
jmp end_if
number_wasnt_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsNotPrime
call printf
add rsp, 32
end_if:
mov rbp, rsp
pop rbp
ret
primes assembly
New contributor
Have you run the code, and does it work correctly?
â 1201ProgramAlarm
3 hours ago
3
Yes, otherwise it would be on SO
â Mr. Vix
2 hours ago
Which assembler are you using?
â 1201ProgramAlarm
2 hours ago
The x64 Native Tools for VS2017 (NASM version 2.13.03 compiled on Feb 7 2018)
â Mr. Vix
2 hours ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm just learning Assembly. This program is a simple attempt to determine if a given number is prime or not. Any advice and all topical comments on code optimization and conventions is appreciated!
Compiled as follows using VS2017 x64 Native Tools Command Prompt
:
nasm -g -fwin64 isprime.asm
cl /Zi isprime.obj msvcrt.lib legacy_stdio_definitions.lib
isprime.asm
bits 64
default rel
extern printf
extern scanf
section .data
number: dq 0
isPrime: dq 1
counter: dq 0
question: db "Which number would you like to check? ", 0
fmt: db "%d", 0
numberIsPrime: db "%d is prime", 10, 0
numberIsNotPrime: db "%d is not prime", 10, 0
section .text
global main
main:
push rbp
mov rbp, rsp
sub rsp, 32
mov rcx, question
call printf
add rsp, 32
sub rsp, 32
mov rdx, number
mov rcx, fmt
call scanf
add rsp, 32
mov rcx, [number]
mov [counter], rcx
continue_prime_check:
dec qword [counter]
cmp qword [counter], 2
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:
mov rax, [number]
cdq
mov rbx, [counter]
idiv rbx
cmp edx, 0
je evenly_divisible
jmp not_evenly_divisible
evenly_divisible:
mov qword [isPrime], 0
not_evenly_divisible:
jmp continue_prime_check
prime_check_ended:
cmp qword [isPrime], 1
je number_was_prime
jmp number_wasnt_prime
number_was_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsPrime
call printf
add rsp, 32
jmp end_if
number_wasnt_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsNotPrime
call printf
add rsp, 32
end_if:
mov rbp, rsp
pop rbp
ret
primes assembly
New contributor
I'm just learning Assembly. This program is a simple attempt to determine if a given number is prime or not. Any advice and all topical comments on code optimization and conventions is appreciated!
Compiled as follows using VS2017 x64 Native Tools Command Prompt
:
nasm -g -fwin64 isprime.asm
cl /Zi isprime.obj msvcrt.lib legacy_stdio_definitions.lib
isprime.asm
bits 64
default rel
extern printf
extern scanf
section .data
number: dq 0
isPrime: dq 1
counter: dq 0
question: db "Which number would you like to check? ", 0
fmt: db "%d", 0
numberIsPrime: db "%d is prime", 10, 0
numberIsNotPrime: db "%d is not prime", 10, 0
section .text
global main
main:
push rbp
mov rbp, rsp
sub rsp, 32
mov rcx, question
call printf
add rsp, 32
sub rsp, 32
mov rdx, number
mov rcx, fmt
call scanf
add rsp, 32
mov rcx, [number]
mov [counter], rcx
continue_prime_check:
dec qword [counter]
cmp qword [counter], 2
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:
mov rax, [number]
cdq
mov rbx, [counter]
idiv rbx
cmp edx, 0
je evenly_divisible
jmp not_evenly_divisible
evenly_divisible:
mov qword [isPrime], 0
not_evenly_divisible:
jmp continue_prime_check
prime_check_ended:
cmp qword [isPrime], 1
je number_was_prime
jmp number_wasnt_prime
number_was_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsPrime
call printf
add rsp, 32
jmp end_if
number_wasnt_prime:
sub rsp, 32
mov rdx, [number]
mov rcx, numberIsNotPrime
call printf
add rsp, 32
end_if:
mov rbp, rsp
pop rbp
ret
primes assembly
primes assembly
New contributor
New contributor
edited 2 hours ago
New contributor
asked 3 hours ago
Mr. Vix
183
183
New contributor
New contributor
Have you run the code, and does it work correctly?
â 1201ProgramAlarm
3 hours ago
3
Yes, otherwise it would be on SO
â Mr. Vix
2 hours ago
Which assembler are you using?
â 1201ProgramAlarm
2 hours ago
The x64 Native Tools for VS2017 (NASM version 2.13.03 compiled on Feb 7 2018)
â Mr. Vix
2 hours ago
add a comment |Â
Have you run the code, and does it work correctly?
â 1201ProgramAlarm
3 hours ago
3
Yes, otherwise it would be on SO
â Mr. Vix
2 hours ago
Which assembler are you using?
â 1201ProgramAlarm
2 hours ago
The x64 Native Tools for VS2017 (NASM version 2.13.03 compiled on Feb 7 2018)
â Mr. Vix
2 hours ago
Have you run the code, and does it work correctly?
â 1201ProgramAlarm
3 hours ago
Have you run the code, and does it work correctly?
â 1201ProgramAlarm
3 hours ago
3
3
Yes, otherwise it would be on SO
â Mr. Vix
2 hours ago
Yes, otherwise it would be on SO
â Mr. Vix
2 hours ago
Which assembler are you using?
â 1201ProgramAlarm
2 hours ago
Which assembler are you using?
â 1201ProgramAlarm
2 hours ago
The x64 Native Tools for VS2017 (NASM version 2.13.03 compiled on Feb 7 2018)
â Mr. Vix
2 hours ago
The x64 Native Tools for VS2017 (NASM version 2.13.03 compiled on Feb 7 2018)
â Mr. Vix
2 hours ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
There are numerous small things.
- You don't have to keep subtracting and adding 32 from
rsp
. Allocate the space once at the start of the function (main
), reuse it for the duration, and add it back at the end (but see below). - My personal preference would be to use
mov ecx,offset question
to make it clear that I want the address of the variable, and not the contents of it. - Start your prime check with the low numbers, not the high ones. They're far more likely to be divisors.
- Check for divisible by 2 first (before your loop), then you only need to check the odd numbers in your loop.
Instead of a conditional jump around an unconditional jump, negate the condition. So you'd change
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:to
jnge prime_check_ended ; or j
Instead of
cmp edx,0
, you can usetest edx,edx
. Thetest
will do a bit-wise logicaland
of the two operands and set the flags accordingly without storing the result of theand
. This is a common way to check for zero.- Once you find that your number is not prime, you can stop looping.
- You can also stop looping once you get to the square root of
number
. This is often done by comparing the square ofcounter
withnumber
, but you can easily check it by comparingeax
withcounter
after the division. Ifeax
is less or equal to counter you can stop looping. - Your
mov rbp,rsp
at the end is backwards. It should bemov rsp,rbp
. This will also remove the 32 bytes of stack space you reserved for argument storage during function calls, so you don't need to explicitly add those 32 bytes back to the stack pointer.
For point one, do you meanrsp
? I'm also guessing you're referring to themain
ftn. If you may also give some more info on point six I'd appreciate it!
â Mr. Vix
2 hours ago
@Mr.Vix I've rephrased point one and expanded on point six.
â 1201ProgramAlarm
1 hour ago
So just to clarify, you mean all I need to do is havesub rsp
in place of the firstsub rsp, 32
in mymain
ftn, and then make themov rsp, rbp
change? All of the othersub rsp, 32
andadd rsp, 32
calls can be deleted?
â Mr. Vix
1 hour ago
@Mr.Vix Yes. Only onesub
and noadd
s.
â 1201ProgramAlarm
1 hour ago
Great thank you!
â Mr. Vix
54 mins ago
add a comment |Â
up vote
0
down vote
The printing branches are identical, except that they load
rcx
with different addresses. Better setuprcx
when you arrive to the conclusion, and unify printing.Expanding on that, an idiomatic assembly program would first guess the right string, and correct it if it was wrong:
prime_check_ended:
mov rcx, numberIsPrime
cmp cmp qword [isPrime], 1
je print_result
mov rcx, numberIsNotPrime
print_result:
mov rdx, [number]
call printfI don't know wether NASM supports local labels. If it does, it is a good habit to use them. Otherwise you risk polluting the label space.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
There are numerous small things.
- You don't have to keep subtracting and adding 32 from
rsp
. Allocate the space once at the start of the function (main
), reuse it for the duration, and add it back at the end (but see below). - My personal preference would be to use
mov ecx,offset question
to make it clear that I want the address of the variable, and not the contents of it. - Start your prime check with the low numbers, not the high ones. They're far more likely to be divisors.
- Check for divisible by 2 first (before your loop), then you only need to check the odd numbers in your loop.
Instead of a conditional jump around an unconditional jump, negate the condition. So you'd change
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:to
jnge prime_check_ended ; or j
Instead of
cmp edx,0
, you can usetest edx,edx
. Thetest
will do a bit-wise logicaland
of the two operands and set the flags accordingly without storing the result of theand
. This is a common way to check for zero.- Once you find that your number is not prime, you can stop looping.
- You can also stop looping once you get to the square root of
number
. This is often done by comparing the square ofcounter
withnumber
, but you can easily check it by comparingeax
withcounter
after the division. Ifeax
is less or equal to counter you can stop looping. - Your
mov rbp,rsp
at the end is backwards. It should bemov rsp,rbp
. This will also remove the 32 bytes of stack space you reserved for argument storage during function calls, so you don't need to explicitly add those 32 bytes back to the stack pointer.
For point one, do you meanrsp
? I'm also guessing you're referring to themain
ftn. If you may also give some more info on point six I'd appreciate it!
â Mr. Vix
2 hours ago
@Mr.Vix I've rephrased point one and expanded on point six.
â 1201ProgramAlarm
1 hour ago
So just to clarify, you mean all I need to do is havesub rsp
in place of the firstsub rsp, 32
in mymain
ftn, and then make themov rsp, rbp
change? All of the othersub rsp, 32
andadd rsp, 32
calls can be deleted?
â Mr. Vix
1 hour ago
@Mr.Vix Yes. Only onesub
and noadd
s.
â 1201ProgramAlarm
1 hour ago
Great thank you!
â Mr. Vix
54 mins ago
add a comment |Â
up vote
2
down vote
accepted
There are numerous small things.
- You don't have to keep subtracting and adding 32 from
rsp
. Allocate the space once at the start of the function (main
), reuse it for the duration, and add it back at the end (but see below). - My personal preference would be to use
mov ecx,offset question
to make it clear that I want the address of the variable, and not the contents of it. - Start your prime check with the low numbers, not the high ones. They're far more likely to be divisors.
- Check for divisible by 2 first (before your loop), then you only need to check the odd numbers in your loop.
Instead of a conditional jump around an unconditional jump, negate the condition. So you'd change
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:to
jnge prime_check_ended ; or j
Instead of
cmp edx,0
, you can usetest edx,edx
. Thetest
will do a bit-wise logicaland
of the two operands and set the flags accordingly without storing the result of theand
. This is a common way to check for zero.- Once you find that your number is not prime, you can stop looping.
- You can also stop looping once you get to the square root of
number
. This is often done by comparing the square ofcounter
withnumber
, but you can easily check it by comparingeax
withcounter
after the division. Ifeax
is less or equal to counter you can stop looping. - Your
mov rbp,rsp
at the end is backwards. It should bemov rsp,rbp
. This will also remove the 32 bytes of stack space you reserved for argument storage during function calls, so you don't need to explicitly add those 32 bytes back to the stack pointer.
For point one, do you meanrsp
? I'm also guessing you're referring to themain
ftn. If you may also give some more info on point six I'd appreciate it!
â Mr. Vix
2 hours ago
@Mr.Vix I've rephrased point one and expanded on point six.
â 1201ProgramAlarm
1 hour ago
So just to clarify, you mean all I need to do is havesub rsp
in place of the firstsub rsp, 32
in mymain
ftn, and then make themov rsp, rbp
change? All of the othersub rsp, 32
andadd rsp, 32
calls can be deleted?
â Mr. Vix
1 hour ago
@Mr.Vix Yes. Only onesub
and noadd
s.
â 1201ProgramAlarm
1 hour ago
Great thank you!
â Mr. Vix
54 mins ago
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
There are numerous small things.
- You don't have to keep subtracting and adding 32 from
rsp
. Allocate the space once at the start of the function (main
), reuse it for the duration, and add it back at the end (but see below). - My personal preference would be to use
mov ecx,offset question
to make it clear that I want the address of the variable, and not the contents of it. - Start your prime check with the low numbers, not the high ones. They're far more likely to be divisors.
- Check for divisible by 2 first (before your loop), then you only need to check the odd numbers in your loop.
Instead of a conditional jump around an unconditional jump, negate the condition. So you'd change
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:to
jnge prime_check_ended ; or j
Instead of
cmp edx,0
, you can usetest edx,edx
. Thetest
will do a bit-wise logicaland
of the two operands and set the flags accordingly without storing the result of theand
. This is a common way to check for zero.- Once you find that your number is not prime, you can stop looping.
- You can also stop looping once you get to the square root of
number
. This is often done by comparing the square ofcounter
withnumber
, but you can easily check it by comparingeax
withcounter
after the division. Ifeax
is less or equal to counter you can stop looping. - Your
mov rbp,rsp
at the end is backwards. It should bemov rsp,rbp
. This will also remove the 32 bytes of stack space you reserved for argument storage during function calls, so you don't need to explicitly add those 32 bytes back to the stack pointer.
There are numerous small things.
- You don't have to keep subtracting and adding 32 from
rsp
. Allocate the space once at the start of the function (main
), reuse it for the duration, and add it back at the end (but see below). - My personal preference would be to use
mov ecx,offset question
to make it clear that I want the address of the variable, and not the contents of it. - Start your prime check with the low numbers, not the high ones. They're far more likely to be divisors.
- Check for divisible by 2 first (before your loop), then you only need to check the odd numbers in your loop.
Instead of a conditional jump around an unconditional jump, negate the condition. So you'd change
jge not_reached_1_yet
jmp prime_check_ended
not_reached_1_yet:to
jnge prime_check_ended ; or j
Instead of
cmp edx,0
, you can usetest edx,edx
. Thetest
will do a bit-wise logicaland
of the two operands and set the flags accordingly without storing the result of theand
. This is a common way to check for zero.- Once you find that your number is not prime, you can stop looping.
- You can also stop looping once you get to the square root of
number
. This is often done by comparing the square ofcounter
withnumber
, but you can easily check it by comparingeax
withcounter
after the division. Ifeax
is less or equal to counter you can stop looping. - Your
mov rbp,rsp
at the end is backwards. It should bemov rsp,rbp
. This will also remove the 32 bytes of stack space you reserved for argument storage during function calls, so you don't need to explicitly add those 32 bytes back to the stack pointer.
edited 1 hour ago
answered 2 hours ago
1201ProgramAlarm
2,7152720
2,7152720
For point one, do you meanrsp
? I'm also guessing you're referring to themain
ftn. If you may also give some more info on point six I'd appreciate it!
â Mr. Vix
2 hours ago
@Mr.Vix I've rephrased point one and expanded on point six.
â 1201ProgramAlarm
1 hour ago
So just to clarify, you mean all I need to do is havesub rsp
in place of the firstsub rsp, 32
in mymain
ftn, and then make themov rsp, rbp
change? All of the othersub rsp, 32
andadd rsp, 32
calls can be deleted?
â Mr. Vix
1 hour ago
@Mr.Vix Yes. Only onesub
and noadd
s.
â 1201ProgramAlarm
1 hour ago
Great thank you!
â Mr. Vix
54 mins ago
add a comment |Â
For point one, do you meanrsp
? I'm also guessing you're referring to themain
ftn. If you may also give some more info on point six I'd appreciate it!
â Mr. Vix
2 hours ago
@Mr.Vix I've rephrased point one and expanded on point six.
â 1201ProgramAlarm
1 hour ago
So just to clarify, you mean all I need to do is havesub rsp
in place of the firstsub rsp, 32
in mymain
ftn, and then make themov rsp, rbp
change? All of the othersub rsp, 32
andadd rsp, 32
calls can be deleted?
â Mr. Vix
1 hour ago
@Mr.Vix Yes. Only onesub
and noadd
s.
â 1201ProgramAlarm
1 hour ago
Great thank you!
â Mr. Vix
54 mins ago
For point one, do you mean
rsp
? I'm also guessing you're referring to the main
ftn. If you may also give some more info on point six I'd appreciate it!â Mr. Vix
2 hours ago
For point one, do you mean
rsp
? I'm also guessing you're referring to the main
ftn. If you may also give some more info on point six I'd appreciate it!â Mr. Vix
2 hours ago
@Mr.Vix I've rephrased point one and expanded on point six.
â 1201ProgramAlarm
1 hour ago
@Mr.Vix I've rephrased point one and expanded on point six.
â 1201ProgramAlarm
1 hour ago
So just to clarify, you mean all I need to do is have
sub rsp
in place of the first sub rsp, 32
in my main
ftn, and then make the mov rsp, rbp
change? All of the other sub rsp, 32
and add rsp, 32
calls can be deleted?â Mr. Vix
1 hour ago
So just to clarify, you mean all I need to do is have
sub rsp
in place of the first sub rsp, 32
in my main
ftn, and then make the mov rsp, rbp
change? All of the other sub rsp, 32
and add rsp, 32
calls can be deleted?â Mr. Vix
1 hour ago
@Mr.Vix Yes. Only one
sub
and no add
s.â 1201ProgramAlarm
1 hour ago
@Mr.Vix Yes. Only one
sub
and no add
s.â 1201ProgramAlarm
1 hour ago
Great thank you!
â Mr. Vix
54 mins ago
Great thank you!
â Mr. Vix
54 mins ago
add a comment |Â
up vote
0
down vote
The printing branches are identical, except that they load
rcx
with different addresses. Better setuprcx
when you arrive to the conclusion, and unify printing.Expanding on that, an idiomatic assembly program would first guess the right string, and correct it if it was wrong:
prime_check_ended:
mov rcx, numberIsPrime
cmp cmp qword [isPrime], 1
je print_result
mov rcx, numberIsNotPrime
print_result:
mov rdx, [number]
call printfI don't know wether NASM supports local labels. If it does, it is a good habit to use them. Otherwise you risk polluting the label space.
add a comment |Â
up vote
0
down vote
The printing branches are identical, except that they load
rcx
with different addresses. Better setuprcx
when you arrive to the conclusion, and unify printing.Expanding on that, an idiomatic assembly program would first guess the right string, and correct it if it was wrong:
prime_check_ended:
mov rcx, numberIsPrime
cmp cmp qword [isPrime], 1
je print_result
mov rcx, numberIsNotPrime
print_result:
mov rdx, [number]
call printfI don't know wether NASM supports local labels. If it does, it is a good habit to use them. Otherwise you risk polluting the label space.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
The printing branches are identical, except that they load
rcx
with different addresses. Better setuprcx
when you arrive to the conclusion, and unify printing.Expanding on that, an idiomatic assembly program would first guess the right string, and correct it if it was wrong:
prime_check_ended:
mov rcx, numberIsPrime
cmp cmp qword [isPrime], 1
je print_result
mov rcx, numberIsNotPrime
print_result:
mov rdx, [number]
call printfI don't know wether NASM supports local labels. If it does, it is a good habit to use them. Otherwise you risk polluting the label space.
The printing branches are identical, except that they load
rcx
with different addresses. Better setuprcx
when you arrive to the conclusion, and unify printing.Expanding on that, an idiomatic assembly program would first guess the right string, and correct it if it was wrong:
prime_check_ended:
mov rcx, numberIsPrime
cmp cmp qword [isPrime], 1
je print_result
mov rcx, numberIsNotPrime
print_result:
mov rdx, [number]
call printfI don't know wether NASM supports local labels. If it does, it is a good habit to use them. Otherwise you risk polluting the label space.
answered 31 mins ago
vnp
37.3k12993
37.3k12993
add a comment |Â
add a comment |Â
Mr. Vix is a new contributor. Be nice, and check out our Code of Conduct.
Mr. Vix is a new contributor. Be nice, and check out our Code of Conduct.
Mr. Vix is a new contributor. Be nice, and check out our Code of Conduct.
Mr. Vix is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f204902%2fchecking-if-a-number-is-prime-in-x64-assembly%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Have you run the code, and does it work correctly?
â 1201ProgramAlarm
3 hours ago
3
Yes, otherwise it would be on SO
â Mr. Vix
2 hours ago
Which assembler are you using?
â 1201ProgramAlarm
2 hours ago
The x64 Native Tools for VS2017 (NASM version 2.13.03 compiled on Feb 7 2018)
â Mr. Vix
2 hours ago