In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to realize switch disassembly in c language". In daily operation, I believe many people have doubts about how to realize switch disassembly in c language. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to realize switch disassembly in c language". Next, please follow the editor to study!
When there are more branches, the efficiency of switch is higher than that of if. We can see the reason for the high efficiency in disassembly.
1. Switch statement 1. When forward coding, switch statement can be regarded as the abbreviation of if statement.
2. Ingenious use of break in switch statement
1. When there are three branches in switch
When break is removed,
2. Disassembly of switch statements 1. When there are three branches of switch, # includevoid Function (int x) {switch (x) {case 1: printf ("1"); case 2: printf ("2"); case 3: printf ("3") Default: printf ("4");}} int main () {Function (2); return 0;}
As you can see, the disassembly code of switch is no different from the if statement at this time.
A large table is generated when there are four if statements.
2. When there are four branches in the switch statement, the compiler produces a large table
Steps:
1. Subtract 1 from the incoming number, and then make a comparison. Determine whether the parameter exceeds the maximum constant in the switch statement, that is, whether the parameter goes directly into default or case.
2. If the parameter
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.