Remove code duplication in sgen-descriptor.h