Determination of the magnetic fields of Magellanic X-ray pulsars