Use S_IS* macros instead of direct bit manipulations