Close, but you can only log safety pilot PIC in a time when the conditions warrant that. IE, the taxiing and taxeoff of the aircraft wouldn't be done under simulated instrument conditions, so you can't count that time on the ground or in departure until the simulated instrument conditions actually begin. Granted, you could throw the hood on immediately after rotating, but you get my point.
So, in the scenario you referenced, it would be:
Left seat PIC gets 4.0 XC, 4.0 night, 3.8 sim
Safety pilot gets: 3.8 PIC w/ 3.8 being night.
The safety pilot wouldn't actually get XC time because he was not a required crew member during takeoff and landing. See the distinction?
A great way to make it even-steven with a safety pilot friend would be to break it up by legs. For example:
Pilot A flies first leg left seat on a XC from ABC to DEF. He would log 2.0 PIC, 2.0 night, 2.0 XC, and 1.8 sim instrument.
Pilot B as safety pilot would log 1.8 PIC & night.
On the way back home, if you reverse roles you would get:
Pilot B flies second leg from DEF to ABC. He logs 2.0 PIC, 2.0 night, 2.0 XC and 1.8 sim instrument.
Pilot A is safety pilot this time and logs 1.8 PIC and night.
In the end, what you get is:
Pilot A: 3.8 PIC, 3.8 night, 2.0 XC, 1.8 simulated instrument
Pilot B: 3.8 PIC, 3.8 night, 2.0 XC, 1.8 simulated instrument
Comes out equal. Clear as mud?