It’s fairly simple. If you want your icon to be eg. 64x64 px that mean that on non-retina devices (like laptops, screens etc) your icon will be seen as 64x64. On retina display, where the pixel-ratio is twice as big, the icon will be very small (half of the size) while still having 64x64px. Website will automatically stretch the icon to twice the size (128x128px) so it will be same size on screen. If you had a 64x64px image, on retina devices it will be stretched to twice its size.
Now… If you had the icon already twice the size (@2x) so it is 128x128px and you set the HiDPI the image will be shown with half its pixels size 64x64px for regular screens and 128x128px for retina devices which will give you high quality image.
If you have the ability you can create vector images and export them in SVG file. You can use such vector image file so it looks absolutely PERFECT across all devices - doesn’t matter if it’s @2x or @3x