If you are arrested the Officer is allowed to search you better then just patting you down. Once you are arrested the Officer is allowed to search all of your possessions for weapons and contraband that are within your reach. The Officer can go through a backpack you might be carrying, or a purse, look through your wallet, look in your shoes, etc. Yes, the Officer can check your bike shorts to make sure you don't have a razor blade or bindles of heroine in the waistband. That is called a search incident to arrest.
A pat down or frisk is used when someone is not under arrest but the Officer has reason to believe the person possess a threat and may be armed. If the Officer believes you might be concealing a weapon in your shorts then they may frisk you. Just because they are tight does not mean you can't hide a weapon.