[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-hackers
Subject: type casts in KLD
From: Artis Caune <ac-lists () latnet ! lv>
Date: 2004-02-24 14:51:47
Message-ID: opr3vp8lducpfy5d () mail ! latnet ! lv
[Download RAW message or body]
Hi!
I'm writting kld module, and have some weird problems
with mixing types and casts.
e.x.
"if (long + u_long + u_long < 0)" don't work,
but
"if (long < 0 - u_long - u_long)" works fine!
and code like this:
"cur_rate = min_rate + \
(((max_rate - min_rate) * \
(cur_level / level / 100))) / 100)"
where:
cur_rate, min_rate, max_rate - u_long;
cur_level, level - u_quad_t ;
I cast-ed expresion:
"cur_rate = min_rate + \
(((max_rate - min_rate) * \
((u_long) cur_level / (u_quad_t) level / 100))) /
(u_long) 100)"
and it seems to be ok!
Someone can point me to article, url where
I can find more about complex arithmetic operations
with different types and
how to proper use different types in "if" statements?
--
Artis
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic