Stacking faults in YBa2Cu3O7−x: Measurement using x-ray diffraction and effects on critical current