High court extends gun rights to states