разметкой?
                  
                  
                  
                  
                  
                  Хитрый вопрос! Как думаете, какой код выполнится быстрее? 
                  
                  
                  Первый?
                  
                  
                  static void calcIndexesAutoVectorise(std::int32_t* const out,
                  
                  
                                                       const Position* const position,
                  
                  
                                                       const std::size_t count,
                  
                  
                                                       const std::int32_t size_x,
                  
                  
                                                       const std::int32_t size_y)
                  
                  
                  {
                  
                  
                    for (std::size_t i = 0; i < count; ++i) {
                  
                  
                      std::int32_t x = position[i].x - ((position[i].x / size_x) * size_x);
                  
                  
                      std::int32_t y = position[i].y - ((position[i].y / size_y) * size_y);
                  
                  
                      if (x < 0) {
                  
                  
                        x = size_x - std::abs(x);
                  
                  
                      }
                  
                  
                      if (y < 0) {
                  
                  
                        y = size_y - std::abs(y);
                  
                  
                      }
                  
                  
                      out[i] = y + x * size_x;
                  
                  
                    }
                  
                  
                  }
                  
                  
                  Или второй?
                  
                  
                  
                  
                  
                  static void calcIndexesAutoVectorise(std::int32_t* const out,
                  
                  
                                                       const Position* const position,
                  
                  
                                                       const std::size_t count,
                  
                  
                                                       const std::int32_t size_x,
                  
                  
                                                       const std::int32_t size_y)
                  
                  
                  {
                  
                  
                    for (std::size_t i = 0; i < count; ++i) {
                  
                  
                      std::int32_t x = position[i].x - (static_cast<std::int32_t>(static_cast<float>(position[i].x) / static_cast<float>(size_x)) * size_x);
                  
                  
                      std::int32_t y = position[i].y - (static_cast<std::int32_t>(static_cast<float>(position[i].y) / static_cast<float>(size_y)) * size_y);
                  
                  
                      if (x < 0) {
                  
                  
                        x = size_x - std::abs(x);
                  
                  
                      }
                  
                  
                      if (y < 0) {
                  
                  
                        y = size_y - std::abs(y);
                  
                  
                      }
                  
                  
                      out[i] = y + x * size_x;
                  
                  
                    }
                  
                  
                  }
                  
                  
                  Можно не вглядываться, они различаются только преобразованиями во float и обратно в инт, в теле цикла. 
                  
                  
                  
                  
                  
                  Ну что думаете? 😝
                  
                  
                
В супе вряд ли кто-то ответит
 Александр
                          
                        
                      
                    
                    
                    
                    
                      Автор вопроса
                      
                      
                        
                          Александр
                          
                        
                      
                    
                    
                    
                    
                      Автор вопроса
                    
                    
                  пон, выезжаю в про
судя по постановке вопроса конечно тот что выглядит страшнее
 Александр
                          
                        
                      
                    
                    
                    
                    
                      Автор вопроса
                      
                      
                        
                          Александр
                          
                        
                      
                    
                    
                    
                    
                      Автор вопроса
                    
                    
                  отвечу в про, ща туда перекину, а здесб удалю
 Александр
                          
                        
                      
                    
                    
                    
                    
                      Автор вопроса
                      
                      
                        
                          Александр
                          
                        
                      
                    
                    
                    
                    
                      Автор вопроса
                    
                    
                  Обсуждают сегодня