How to use lazy propagation on segment tree in case of node's value is updating via XOR?

The problem is to update the elements of the range [L, R] via XOR- ing each of them with the given X.
In the case of just a normal segment tree, we can use lazy propagation to calculate the parent node sum value just in this way:

(end - start + 1) * val

And the whole code for an update, in this case, could be like as shown below:

void updateRange(int node, int start, int end, int l, int r, int val)
{
    if(lazy[node] != 0)
    {         
        tree[node] += (end - start + 1) * lazy[node]; 
        if(start != end)
        {
            lazy[node*2] += lazy[node];  
            lazy[node*2+1] += lazy[node]; 
        }
        lazy[node] = 0;  
    }
    if(start > end or start > r or end < l)  
        return;
    if(start >= l and end <= r)
    {        
        tree[node] += (end - start + 1) * val;
        if(start != end)
        {            
            lazy[node*2] += val;
            lazy[node*2+1] += val;
        }
        return;
    }
    int mid = (start + end) / 2;
    updateRange(node*2, start, mid, l, r, val); 
    updateRange(node*2 + 1, mid + 1, end, l, r, val);
    tree[node] = tree[node*2] + tree[node*2+1]; 
}

But the problem in the case of XOR is that we can’t write something like (end - start + 1) * val for the parent node?
So which techniques could be applied in such a case?