Ethical Hacking Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package. | Computer Forensics Training at InfoSec Institute Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors. |

| Subject: | Re: modulo question |
|---|---|
| Date: | Tue, 19 Apr 2005 09:59:09 +0400 |
Hello,
--1 will decrement and is not negative.
descript-mac:~ descript$ cat > test.c
int main() {
printf("%d", --1);
}
descript-mac:~ descript$ cc -o test test.c
test.c: In function `main':
test.c:2: error: invalid lvalue in decrementand is invalid.
Using modulo with negative numbers ?! 0xFEBA3245-(0xFEBA3245%0x1000) = 4K aligned page.
descript-mac:~ descript$ cat > test.c
int main() {
long plof = 0xFEBA3245;
printf("Number : %lx(%ld)\n", plof, plof);
printf("4Ko alignement: %lx\n", plof-(plof%0x1000));
}
descript-mac:~ descript$ cc -o test test.c
descript-mac:~ descript$ ./test
Number : feba3245(-21351867)
4Ko alignement: feba4000sya
On 15 avr. 05, at 12:47, martin wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello list,
I have slightly academic question about modulo. I sent this message here
because I thing there are many of gurus which working with modulo operator.
I have tried in python and in C++ following: python C++ 1%2 1 1 - -1%2 1 -1 1%-2 -1 1 - -1%-2 -1 -1
What is right?
Do you know some applications which using modulo with negative numbers?
Have you some references to definition (mathematical def. and properties) of
modulo?
Thanks in advance, Martin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFCX4Bc9w5olJf0Oq8RAsvSAKCnvAdrdXBL/aqiSTCANjT2BKb7NACcCCel 7b+pYp0k/1hMQPOyAY2M5/4= =zLC1 -----END PGP SIGNATURE-----
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Recon 2005 - Speakers list, dataworm |
|---|---|
| Next by Date: | RE: suggesting passwds to users, Matt Fisher |
| Previous by Thread: | modulo question, martin |
| Next by Thread: | Re: modulo question, Skip Carter |
| Indexes: | [Date] [Thread] [Top] [All Lists] |