Flight planning is based primarily on time not on ground distance, by this I mean fuel burn is in pounds per hour at a given airspeed, not pounds per mile or miles per pound. Airplanes come with pages of charts showing fuel burn at many combinations of airspeeds, gross weights, altitudes, and temperatures. They also come with fuel and time required to climb to various altitudes and fuel used during startup and taxi.
Modern airline dispatchers use computer programs to calculate the actual time and fuel burn with more precision(interpolating between data points), and importantly with great speed.
A flight leg for fuel planning is a segment between navigation fixes and is commonly 50-300 miles. Even when crossing the ocean there are charted navigation fixes where pilots report to ATC over the radio.
The older manual method was to calculate tailwind or headwind for each leg of the proposed route based on weather forecasts and then calculate time en-route for each leg based on a desired cruise airspeed.(climb and decent are special legs, also included) This time is used for a rough estimate of total fuel burn for the flight to then get a close estimate of gross takeoff weight. The estimate of gross takeoff weight is then used to calculate the fuel consumption for the first leg of the flight, the fuel consumed on the first leg is then subtracted from gross weight to get a new gross weight and rate of fuel consumption for the second leg of the flight. This sequence continues for each leg. Then sum all of the fuel burned on each leg of the route (along with reserve fuel) add this fuel weight to the empty weight and payload weight. Finally check to make sure the flight is within limits by comparing the total fuel needed to the rated fuel tank capacity and checking the total weight sum is less than the allowed maximum takeoff weight of the airplane for the specific departure runway length, climb-out obstacle clearance gradient, and current headwind.
The maximum takeoff weight for a certain set of airport conditions is the common limit on range, the airplane's published maximum structural takeoff weight or fuel tank capacity are less often the limiting factors. Landing is rarely a limit simply because a safe takeoff and climb requires a much longer runway[accelerate plus stop] and a lower obstacle clearance slope [with one engine failure] than is needed for a landing; and you would not purposefully land at an airport that would not also allow a safe departure with a reasonable load. I bring this up because it is possible that if prevailing winds are reliable through the year, and if the physical takeoff limits at SIN are different from SFO, the route could be designed such that a 17 hour flight is only allowable in one direction.