Domestic tourists, first fly directly to Hong Kong International Airport, stay for 2 days, go to Macau after that, and return to Hong Kong, in total within 7 days, is it possible?

Domestic tourists, first fly directly to Hong Kong International Airport, stay for 2 days, go to Macau after that, and then return to Hong Kong. In total, within 7 days, is it possible to…
Of course, I have had friends do it before, as long as they have a Hong Kong and Macau Entry Permit and visa annotation.
Of course, I have had friends do this before, just need a Hong Kong and Macau permit and a visa stamp.