当前位置:网站首页>1280_ C language to find the average value of two unsigned integer

1280_ C language to find the average value of two unsigned integer

2022-06-25 04:09:00 grey_ csdn

All learning summary : GitHub - GreyZhang/c_units: A small piece of code which can be reuse anywhere, I call it a unit. This is a collection of unit in C language! Ok, yes, it would be my toolbox.

My toolkit has not been updated for a long time , The modules here were used most before 3 A possible array queue 、map And hysteresis control .

Recently, I saw on the Internet that people at Microsoft explained how to solve the average , I feel like I have learned another trick . natural , There may be overflow when solving the average , You can definitely think of this as long as you ask questions or simply think about it . however , The long-term habitual thinking and the nerve numbness caused by work may make me ignore some details . here , Directly extract a ready-made algorithm and add it to my toolbox .

This implementation is very simple , Even such a simple design has been patented . however , Now the patent protection period has expired . since , Someone once wanted to protect the algorithm in the way of property right. It must be unique , With this toolkit, such versions should also be included .

The effect of compiling and running the above code :

In case of a one thousand , I still got it python Calculated once for comparison , There is no problem with the results of my test . Include such a module , Perhaps the practical value is not particularly high , Because this kind of thinking may be directly brought into the following code after reading . however , Collection is a ceremony worth doing , In this way, I can recover a little calm thinking .

原网站

版权声明
本文为[grey_ csdn]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250148463344.html