Hi Vamshi,
Site-wide administrators always have admin privileges on the security root context, which is an acs_magic_object. So, to check if a user (assume with the ID in the variable user_id) has site-wide admin privileges, make the following call:
permission::permission_p \
-object_id [acs_magic_object security_root_context] \
-party_id $user_id \
-privilege admin
It will return true if the user has SW admin privilege. This works on 4.6.3, I think its the same in 5. Hope this fixes your problem!