Magnetocaloric effect in the ferromagnetic GdNi4M (M = Al, Si) and antiferromagnetic NdNiAl4 compounds