hello guys.recently i was away from the forum.I'M not c programmer and rarely i work with codes.

I need some help about one subject. if you can help, I'll be very glad.

There is one code, written with ansi c language. you can see the code at link:

http://u1312.hizliresim.com/1j/6/v7tr7.png

code is working there is no problem. but i need to change code to other comparasion type, because in my scada system, at same time, 30 same of this code is working at same time and it makes pc to run very very slowly. sometimes pc is freezing and I need to restart pc 4-5times every week. If I reduce the code number to 5 instead of 30, it works without problem, but 30 comparasion must take place at same time. If I change comparasion type I'm sure pc won't freeze ( not with c code, with dynamic comparasion).I just need to understand what code is doing.I posted question to Visual C++ because I could not see ansi c..

As I understand code is reading one decimal number, and divides decimal number to 4096 if result is 1, then returned value is 1, if result is 2, return is 2... like this, return value becomes 0,1,2,4 or 8. but I'm not sure if I understood right.

There is somewhere in code "expression = var1&61440" what is this for? 4096+8192+..= 61440 ok. but what the meaning? if you can describe what this code is doing exactly I'll be very happy.

there is one code more.

http://u1312.hizliresim.com/1j/6/v7ulx.jpg

I need also understand this.expression = var1&768... 768 = 512+256 ok but why not 512+256+1024 ?

if you can help I'll be very happy.

I need a table like this.. if the read value is between

0...4096> result 0,
4097...8192 > result 1
8192..12288> result 2
12288...16384> result 4
16384..32768> result 8
... I'M not sure if I made right table.